Richard noticed this back in January[1]. It is related to Pharo
compatibility and Richard wrote a note to the Pharo list[2] on the
subject, to which Guillermo Polito replied:
>> Now, I'd like to fix this, because it just
introduces noise and probably a lot of strange code. But the
problem is not fixing it on itself, but checking all possible
users relying on such strange behaviour. I bet that fixing it
naively could lead to break your image :).
I would suggest using NumberParser (SqNumberParser or
ExtendedNumberParser depending upon your needs) for parsing
numbers ...
Alternatively you could fix CharacterCollection>>#asInteger
to behave as you'd like ... There are close to a hundred senders
of #asInteger in my stone, and after a quick scan of the senders
I don't see any existing uses of asInteger that rely on the odd
behavior --- most appear to expect a string consisting of
unsigned digits, which AFAICT is handled correctly by either
implementation. But I would be aware that changing the behavior
of CharacterCollection>>#asInteger could cause
unexpected problems in other libraries ...
Dale
[1] https://github.com/GsDevKit/GsDevKit/issues/94
[2]
http://forum.world.st/Can-anyone-explain-asInteger-for-Strings-tc4929502.html
On 03/08/2017 01:51 AM, Marten
Feldtmann via Glass wrote:
'-1' asNumber asInteger -> -1
'-1' asInteger -> 1
Marten
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass