[Cuis-dev] Bug or feature? #asInteger behaviour
Hernan Wilkinson
hernan.wilkinson at 10pines.com
Wed Jan 6 04:44:54 PST 2021
Definitely a bug.
Attached is a change set that fixes it with tests to verify the behavior of
String>>asInteger
I think we should think the behavior a little bit through... for example
'---1' signals an error but '+++1' does not, or '.1' returns 1 but '0.1'
returns 0...
I thinks this are rare cases and the solution is not what we would expect
Cheers!
Hernan.
On Wed, Jan 6, 2021 at 6:27 AM Philip Bernhart via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> Hi,
>
> I just noticed that #asInteger has an unexpected behaviour.
> That I thought is worth pointing out. Depending on what
> someone could interpret as an integer (all unsigned numbers or
> including negative numbers).
>
> I found out while looking at some Pharo code that:
>
> '-1' asInteger => -1 (in Pharo)
> '-1' asInteger => 1 (in Cuis)
>
> 'Mötör-45heäd' asInteger => -45 (in Pharo)
> 'Mötör-45heäd' asInteger => 45 (in Cuis)
>
> So the sign is lost.
>
> Was this intentional? Bug or feature?
>
>
> Thanks,
> Philip
> --
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
--
*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210106/c7fec38e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnsavedChangesTo-BaseImageTests-HAW.002.cs.st
Type: application/octet-stream
Size: 811 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210106/c7fec38e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4520-asIntegerFix-HernanWilkinson-2021Jan06-09h37m-HAW.001.cs.st
Type: application/octet-stream
Size: 2027 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210106/c7fec38e/attachment-0001.obj>
More information about the Cuis-dev
mailing list