Code formatting patterns (was: [squeak-dev] The Trunk: Compiler-cmm.275.mcz)

Chris Muller asqueaker at gmail.com
Sat Oct 5 21:04:05 UTC 2013


>> This precise proposal is argued against by "Inline Message Pattern"
>> (pg. 172 of the book).  Method body's would be starting in all
>> different vertical places, your eyes have to "find" it.  And by
>> consuming more vertical space it will result in more required
>> scrolling.  Methods are often very short, would we really want to see
>> the message pattern take up more space than the body?
>
> You're putting up a straw man here. Nobody is proposing to always put a keyword on a new line. That would make no sense at all.

Oh, I thought that's what you were proposing as an alternative to
Tim's pragma idea.  I guess I misunderstood.

> However, if you have a pattern with many and long keywords, then putting in explicit line breaks may be preferable to the automatic line wrapping. You would do that to group the keywords semantically.

I think it's better to format the language syntax elements
consistently, perhaps with a couple of exceptions like to:do: for the
sake of vertical space.  I think this gives the reader a
more-immediate awareness of the messages being sent, rather than
"reading prose".  It's a program, not a poem.  :)


More information about the Squeak-dev mailing list