String>>asInteger

Michael Roberts mike at mjr104.co.uk
Wed Jan 21 11:52:57 UTC 2004


I was wondering if someone might help me out with the intent behind String>>asInteger and String>>asSignedInteger.

I was puzzled for a while why '-1' asInteger returned '1'.  I was about to ask about this when I stumbled across the second method - aha!

The code for the two methods is largely identical with asSignedInteger appearing two years later.

I was wondering why one would not want the signed behaviour most of the time.  Do people always expect this to be unsigned?  I'm sorry if that's a stupid question!

I was wondering about the consistency:
-3 asInteger -> -3
'-3' asInteger -> 3
-1 asString asInteger -> 1

So I was wondering what the usage would be like if the functionality was reversed and the later called String>>asUnsignedInteger.  

what a lot of wonderng....

Cheers

Mike  



More information about the Squeak-dev mailing list