help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Coding style


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Coding style
Date: Mon, 27 Aug 2007 09:24:11 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)


Some people on IRC told me a more lisp-ish style would be more
appropriate, 'no dangling brackets':

   [[socket isNil
      ifTrue:
         [
            [| conn |
            trycnt := trycnt + 1.


This is of course more compact, but I consider the first example more
readable. Of course in the end it's a matter of taste. But what style
do you recommend?

I will often use a mixture, based on the length of the block. For short blocks, I don't go to a new line; for longer ones, I use the style in your first example (the one I snipped).

Even when using the style I cite above, I will always put something after a keyword, unlike your example (i.e. I would have started the new line after "ifTrue: [").

The conversion tool generates code in the latter format, so soon enough the source code will all be in this format.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]