[GemStone-Smalltalk] #asInteger truncates instead of rounding

Kevin Szabo k.s.szabo at gmail.com
Thu Jan 30 14:59:41 PST 2014

My opinion is that this method should not be changed.

The method #asInteger has truncated forever, and I expect there are many
objects and much undocumented legacy code that rely on this.  I looked at
my Object Reference from ParcPlace Digitalk (Rev 1.1, 1995) and the
documentation for Number>>#asInteger states "Discard any fractional part."
so this behaviour is at least 18 years old.

I did look at Stephane's scanned version of the Blue Book to see if this
behaviour existed since the epoch, but the protocol on number was
#truncated and #rounded (
http://stephane.ducasse.free.fr/FreeBooks/BlueBook/Bluebook.pdf) so
#asInteger is younger than 33 years.


On Thu, Jan 30, 2014 at 1:58 PM, Richard Sargent <
richard.sargent at gemtalksystems.com> wrote:

> As some of you may have noticed, #asInteger truncates. ANSI Smalltalk
> specifies that it should round. Consequently, we are considering changing
> this with the other ANSI compatibility changes we are making for the 3.2
> release.
> I would like to know whether anyone is relying on the the truncation
> behaviour or would rather we do not change this.
> Thanks,
> Richard
> --
> View this message in context:
> http://forum.world.st/asInteger-truncates-instead-of-rounding-tp4740457.html
> Sent from the Gemstone/S mailing list archive at Nabble.com.
> _______________________________________________
> GemStone-Smalltalk mailing list
> GemStone-Smalltalk at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/gemstone-smalltalk/attachments/20140130/2c24579e/attachment.html>

More information about the GemStone-Smalltalk mailing list