2015-09-17 1:18 GMT+02:00 John Brant <brant@refactoryworkers.com>:
On 9/16/2015 10:34 AM, Ben Coman wrote:
On Wed, Sep 16, 2015 at 4:56 PM, Nicolai Hess <nicolaihess@web.de> wrote:
The following method compiles with Opal:
createRedMorph ^ (self new color:Color red); yourself
but gives a syntax error with the old compilers parser
createRedMorph ^ (self new color:Color red)End of block expected -> ; yourself
removing the parenthesis of course works for both. Who is right ?
What is the result in other dialects?
Dolphin lets you do "self ; yourself" as well as the example above. However, both VW & VA don't allow it.
Thanks for the info.
This is a potential incompatibility for little gain.
Anyway I would guess Opal is wrong.
I don't remember if we allowed this on purpose to be compatible with other Smalltalks or if it was a bug we missed. Anyway, a simple fix is to add " and: [node parentheses isEmpty]" to the RBParser>>parseCascadeMessage method:
parseCascadeMessage | node receiver messages semicolons | node := self parseKeywordMessage. (currentToken isSpecial and: [currentToken value = $; and: [node isMessage and: [node parentheses isEmpty]]]) ifFalse: [^node]. ...
John Brant