[squeak-dev] The Trunk: Kernel-nice.402.mcz

Michael Haupt mhaupt at gmail.com
Tue Feb 16 09:16:13 UTC 2010


On Tue, Feb 16, 2010 at 10:08 AM,  <commits at source.squeak.org> wrote:
> +       "Answer a new Integer that has the bit of rank anInteger set to value.
> +       The bit value should be 0 or 1, otherwise raise an Error.
> +       The bits are indexed starting at 1 for the least significant bit.
> +       For negative integers, operate on 2-complement representation."

hm. I understand that Smalltalk's idiomatic way of using 1-based
indexing is applied here, but the indices into bits of integers
correlate fairly strong with the powers of two they represent. I'd
argue that using 0 for the LSB is more appropriate with regard to the
domain being modelled here.

Also, I'd suggest to raise the error early on, instead of at the end
of the entire method.



More information about the Squeak-dev mailing list