Chris Muller wrote:
> On Wed, Mar 3, 2010 at 9:53 AM, Yanni Chiu <[email protected]> wrote:
>> Isn't readability a matter of taste...?
> 
> Not according to the pattern description; did you read it?  It says,
> the "tendency of the eye to distinguish and interpolate vertical and
> horizontal lines. The square brackets used to signify blocks lead the
> eye to create the illusion of a whole rectangle even though one isn't
> there."  For me, it's absolutely true.

I was going from memory of Beck'isms, but I've read it just now. Now I 
remember that I didn't like this rule the last time I read it. I still 
think it's handwaving, without studies done with Smalltalk code, but 
let's go along with the argument for now: the eye can distinguish 
rectangles easily, so to have better readability, arrange '[' and ']' to 
create a rectangular illusion.

In the first example:

     ifTrue: [self recomputeAngle]

I see a rectangle formed by the '[' and ']' on the same line. So, I buy 
the argument.

In the second example given:

     ifTrue:
         [self clearCaches.
         self recomputeAngle]

The rectangle is getting harder for me to spot, and the argument is 
starting to feel sketchy to me.

What happens with more lines:

     ifTrue:
         [self clearCaches.
         self current soleInstance yada yada blah blah
        self recomputeAngle]

Where's the rectangle now? Compare this with the highly disturbing fact 
(to me, anyways) that the first line should have the same level of 
indent as the rest of the lines in the block, but it's tabbed differently.

> I'm not sure what "hanging left bracket" is.  In Rectangular Block,
> subsequent lines have the "same tabbing" so it may be the same thing.

I just made up the term because some other poster had mentioned they'd 
never seen code where the '[' was left dangling at the end of a line. I 
should have give an example:

     ifTrue: [
         line1 yo.
         line2 eh ]

> I don't know how anything related to formatting could be faster than
> having the machine doing it.

When the automated formatting does a poor job, and you have do undo it 
manually. Or, you refactor your code just so the automated formatting 
does a good job.

 > But if you are not using
> automatic-formatting, then you won't really be affected by these
> proposed pretty-print changes..

This thread started out talking about how the core Pharo code base 
should be formatted. Maybe the Squeak thread was only about pretty-printing.

-- 
Yanni


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to