[squeak-dev] [ENH] Syntax extension for continuations
Squeak List
squeaklist at yahoo.com
Thu Nov 4 08:59:20 UTC 2010
i prefer the parenthesis...
self foo: bar ;; + 10 ;; baz
does not look like ST code to me.
a 1/2 cent
----- Original Message ----
From: Igor Stasenko <siguctua at gmail.com>
To: The general-purpose Squeak developers list
<squeak-dev at lists.squeakfoundation.org>; Pharo Development
<Pharo-project at lists.gforge.inria.fr>
Sent: Sun, October 31, 2010 7:37:33 PM
Subject: [squeak-dev] [ENH] Syntax extension for continuations
Hello,
Out of curiosity, i tried to look how it would be hard to change
parser to support extended continuation syntax.
And it was quite simple, i had to change only single method!
A new syntax using double semicolon ';;' to indicate a continuation.
So, code like:
self foo ;; bar ;; zork
is equivalent to:
self foo bar zork
But when its going to binary, or keyword messages, it allows to write
more clean code,
because it not requires using parenthesis.
For instance:
(1/10) asFloat
with new syntax can be written as:
1/10 ;; asFloat
More complex example:
((self foo: bar) + 10 ) baz
can be written as
self foo: bar ;; + 10 ;; baz
Note, that it is same number of characters to type.. but is much more
clean, and less time expensive to code,
because when you coding, you usually type first message:
self foo: bar `
and then you realising that next message is binary and hence you need
to go back to beginning of line and put open paren there:
`( self foo: bar
then again, go to the end of message, and continue typing:
( self foo: bar ` ) + 10
` - is cursor position.
so, it is much more keystrokes & navigation than just typing two semicolons :)
P.S. don't burn me for my herecy, please :)
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|