On Wed, Mar 29, 2017 at 7:59 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
It is all a question of definition, I guess.
(STON fromString: '2e2') = (STON fromString: '2E+2'). => true
(STONJSON fromString: '2e2') = (STONJSON fromString: '2E+2'). => true
(NeoNumberParser parse: '2e2') = (NeoNumberParser parse: '2E+2'). => true
I believe the 'old school' Smalltalk syntax was limited on purpose, to avoid certain ambiguities maybe related to the IDE/tools. It is an open question whether that assumption is still valid.
What was the original assumption/question? Or do we need to build a planet and wait ten million years for the white mice to discover this?
"Be clean & strict in what you produce, be flexible & liberal in what you accept." is a good motto.
So we should allow 2E+2 ? Its a natural expectation that I think a few people get hit by. We have a new compiler which may bypasses the original issue. One consideration though would be cross-dialect compatibility. Squeak/Cuis are presumably lowercase only. Anyone know about VW, Dolphin? cheers -ben
On 29 Mar 2017, at 13:31, Henrik Nergaard <draagren@outlook.com> wrote:
Hi,
Apperently the number parser cannot parse '2E+2' correctly, is this a bug or a feature. ('2E+2' asNumber = '2e2' asNumber)
Is there any reason to why parsing numbers with uppercase exponent letter is not allowed? (see NumberParser >> #exponentLetters)
The parser has a method named #allowPlusSignInExponent sending self >> #allowPlusSign which just returns false. Is there any reason for not allowing the pluss sign / having it as true instead? (I guess it should at least be an ivar so it can be configured?).
Best regards, Henrik