[squeak-dev] Block argument syntax

Bert Freudenberg bert at freudenbergs.de
Fri Mar 1 15:57:47 UTC 2013


On 2013-03-01, at 16:48, Chris Muller <asqueaker at gmail.com> wrote:

>> I know this is true for a number of Smalltalk implementations.  I found it
>> very surprising also.  Someone I worked with always formatted their code
>> this way.  He said it made it easier to double click and highlight the
>> variable.  I wasn't sure that was enough reason to do it but he did.
> 
> So, score +1 for ": x" but ":x" is still left with a score of 0.  What
> is the advantage of writing ":x"?

One char less. Better visual grouping of multiple arguments.

(1) [:a :b|a+b]
(2) [:a :b | a + b]
(3) [ :a :b | a + b ]
(4) [ : a : b | a + b ]

In my eyes, (2) is the best compromise between conciseness and readability. 

- Bert -




More information about the Squeak-dev mailing list