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

Bert Freudenberg bert at freudenbergs.de
Fri Oct 4 18:44:13 UTC 2013


On 2013-10-04, at 20:02, Chris Muller <asqueaker at gmail.com> wrote:

> 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.

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.

- Bert -

> 
> 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