[squeak-dev] Authorize upArrow in binary symbols
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Mon Feb 24 18:52:25 UTC 2014
Though being reserved for return statements, the upArrow ^ could perfectly
be accepted as a character composing a binary selector, like the
verticalBar | already is.
Indeed there is no ambiguity, since the return ^ is always prefixed, while
a binary message never is...
(well, except in the method source, but method source must begin with
selector, it cannot begin with a return statement, so no ambinguity there
neither...).
I don't plan to use or add such selector in core Squeak/Pharo, but I think
that it is important to allow a variety of selectors : it allows the most
simple DSL : one using Smalltalk syntax (no need to define a new syntax, a
new parser, etc...).
If we did it for |, I don't see why we shouldn't for ^.
Note that we recently also extended usage of - at any place in binary
selectors (it was restricted to first position previously), though no core
message is concerned so far.
The main objection could be that a missing period before a return statement
won't be reported, but interpreted as a message send... like in:
x := a+b
^x
But I don't think it's really a feature stopper.
It's very easy to modify the old Compiler and shouldn't be that hard in
Opal too.
I'll try and push a prototype in Squeak inbox this evening.
What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140224/c1c2a56c/attachment.htm
More information about the Squeak-dev
mailing list
|