NewCompiler weird ANSI

nicolas cellier ncellier at ifrance.com
Wed May 23 22:12:27 UTC 2007


As stated in NewCompiler's code, the ANSI syntax:

ClosureCompiler evaluate: '- 1'

is WEIRD!
It answers -1 as a literal negative number, space not being significant. 
BEWARE a tab or cr are significant in current implementation (ANSI?)

This is more confusing than usefull.
It makes people think of a prefixed operator like other languages.
Also, as already said, inside literal array #(- 1) space is significant.

And what about the sign of exponent?
ClosureCompiler evaluate: '-1.0e- 1'. Message not understood e
((-1.0) e) - (1), so space is significant here.

Beside, as NewCompiler accepts minus as last character of a 
multi-character binary selector, this causes further ambiguity.

ClosureCompiler evaluate: '0--1'. is 1 (0-(-1)) last minus is attached 
to digit because there is no space.
ClosureCompiler evaluate: '0-- 1'. Message not understood --
2 contradictory rules
- either space is significant thus selector is #--
- or space is not significant (like '- 1')
The first rule wins apparently

Weak weak ANSI. What was in their mind?

Nicolas




More information about the Squeak-dev mailing list