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

Chris Muller asqueaker at gmail.com
Fri Oct 4 18:02:06 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?

I don't like Tim's idea either, because it doesn't let each individual
define their own formatting preferences in case they have particularly
strong feelings about it (like us!).

Kent Beck isn't my favorite guy, but his Best Practice patterns are
wholly worthwhile, IMO.  He provides very detailed reasons for his
patterns.

On Fri, Oct 4, 2013 at 11:42 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On 2013-10-04, at 18:31, tim Rowledge <tim at rowledge.org> wrote:
>
>>
>> On 04-10-2013, at 9:23 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>>
>>>
>>> That said, I could live with your version below, in particular if it was automatically produced. It just doesn't feel as nice as the hand-formatted one which even takes into account the semantics of keywords to find suitable breaks.
>>
>>
>> We need a pragma to describe how a method's name is formatted by automagic formatters.
>> copyTo: resultBuf from: start to: stop) from: buf startingAt: firstInBuf normalize: nFactor dcOffset: offset
>> <pragma format: (3 5 7)>
>>       self wibble: buf….
>>
>> The pragma says keep the first 3 keyword fragments together, then the next 2 and then the last 2, all as advisory input
>
>
> Well, or just use line breaks in the method pattern.
>
> - Bert -
>
>


More information about the Squeak-dev mailing list