Review Board

1.0

Implements to:by:do: and to:do: in BigInt.

Updated 1 year, 7 months ago

Nicolas Roard Reviewers
EtoileCore
TheRaven
None Etoile trunk (etoile/trunk/Etoile)
Implements Smalltalk's "for loops", to:by:do: and to:do:, allowing to do things such as:
1 to: 10 do: [:x| ETTranscript show: x; cr]

 
Ship it!
Posted 1 year, 7 months ago (January 17th, 2009, 7:18 a.m.)
Most of the time, SmallInts will be the target for this kind of message.  Please provide a SmallInt implementation as well, so we aren't constantly promoting SmallInt to BigInt for loops.

See the implementation of timeRepeat_ in SmallIntMsgs.m.
If you use ints as parameters here you are defining an ABI where this takes an int.  You will not be able to define a version that takes an object parameter.

If you use ids, SmallInts will automatically be boxed.  Please use ids here.
Review request changed
Updated 1 year, 7 months ago (January 18th, 2009, 8:58 a.m.)
Improved the behaviour to properly deals with BigInts. Corresponding changes in SmallInt will follow in another patch.
Posted 1 year, 7 months ago (January 18th, 2009, 9:08 a.m.)
Is there a MsgSendSmallInt.m diff meant to be visible here?
  1. no, I sent it into a separate review.
This won't work if other or by are something other than a BigInt. 
  1. true... It would be pretty rare though. I'll add a check and use longValue.
I wonder if it's worth having a special case here for where self and other fit into a signed int.  The compiler can typically generate much more efficient code for adding a constant than for adding two variables.
Review request changed
Updated 1 year, 7 months ago (January 18th, 2009, 9:37 a.m.)
Added support for other classes than BigInt as parameters...
Ship it!
Posted 1 year, 7 months ago (January 18th, 2009, 9:52 a.m.)
Looks good.