On 24 February 2014 10:52, Nicolas Cellier nicolas.cellier.aka.nice@gmail.com wrote:
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?
I think that I should read _all_ my mail before repyling. I mildly in favour of allowing ^ as a binary selector. It would be nice if we could automatically infer the impact of seemingly minor grammatical changes like this, and sniff out newly introduced ambiguities and such.
frank