binary selectors ambiguity and space
Stephan Rudlof
sr at evolgo.de
Mon May 15 23:52:40 UTC 2006
On 16.05.2006 00:11, Andreas Raab wrote:
> Stephan Rudlof wrote:
>> NCITS J20 DRAFT December, 1997 33 of ANSI Smalltalk Standard revision
>> 1.9; in short:
>> - 'White space is allowed between the '-' and the <number>' for a
>> numeric literal; and
>> - 'If a negative <number literal> follows a binary selector there must
>> intervening white space.'
>
> Just out of curiosity, which of the Smalltalks that claim to be ANSI
> compliant actually implement the above?
> A dead giveaway would probably
> be Number>>#@- (except that according to ANSI this requires spaces, too,
> right? right??? ;-)
My interpretation has been
1. parsing in principal goes from left to right,
2. there is one special case: the - binds from right to left, if it is
standing *alone* before a number,
3. in the case (0 at -1) the - would be eaten by parsing the @- operator
while parsing from left to right (' binarySelector ::= binaryCharacter+
', allowing arbitrary many binary characters).
This is my interpretation... Any others?
Case 2. seen together with
4. binding of - from right to left does *not* apply, if a variable is
following,
5. + does not bind like -,
6. (1 - - 1) is allowed, but (1 + + 1) not,
makes it really very special.
Especially 6. feels odd to me.
Note: Squeak follows 6., but not 3..
To get 3. into the standard there would be a need for a further special
case @- before numbers related to the creation of Points AFAICS. But
Points are not covered by the standard.
Best regards,
Stephan
> so can anyone confirm which Smalltalks out there
> actually compile according to those rules? Briefly checking VW shows it
> doesn't, neither does Squeak. What about others?
>
> Cheers,
> - Andreas
>
>
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|