[squeak-dev] [ENH] Syntax extension for continuations
siguctua at gmail.com
Mon Nov 1 02:37:33 UTC 2010
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.
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 :)
Igor Stasenko AKA sig.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 903 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20101101/1dd84e36/parser-continuations.1.obj
More information about the Squeak-dev