Eliminating assignments and variable syntax (accessors)
Stefan Matthias Aust
sma at netsurf.de
Sun Aug 8 22:20:03 UTC 1999
Jesse Welton wrote:
>Sure. "Noooooo!!!!" How's that?
Well, that's what I expected :-) But actually I'm sure, you format your
code in a way to make it clear to the reader what belongs together and want
don't. If the reader is able to understand this, the compiler should be
able to do this, too.
> (anInteger < 1 or: [anInteger + firstIndex - 1 > lastIndex])
> ifTrue: [self errorNoSuchElement]
> ifFalse: [^ array at: anInteger + firstIndex - 1]
In this example, you indent the second and third line to signal that the
statement that starts in the first line is continued in these two lines.
The Python parser is built this way. IMHO very easy to understand. While
Smalltalk hasn't as much syntax as Python, I might be still useful.
bye
--
Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf.
More information about the Squeak-dev
mailing list
|