new Smalltalk programmer's thoughts

Todd Blanchard tblanchard at
Sat May 6 16:26:40 UTC 2006

On May 6, 2006, at 12:21 AM, Wolfgang Helbig wrote:

> But the changes I'd need in this case are reaching too far. They'd  
> include:
> - Upper bounds of integer intervals are exclusive and lower bounds  
> inclusive
> - Index ranges start at zero
> - The positions of Positionable Streams would take the same values as
>   the indexed variables of their underlying collections.

> So the changes *are* important.
> And hard to implement in Smalltalk.

Really?? I think I could implement this api in a few minutes.

Instead of 1 to: 5 do: [:n|...]

you use method

1 upTo: 5 do: [:n | ... ]

which is trivially implemented on Number as

upTo: n do: aBlock

^self to: (n-1) do: aBlock


For collections, provide an offset wrapper that implements  
SequenceableCollection's interface, but shifts indices by the offset.

Done.  You don't have to change all of Smalltalk to get what you want  
(and most of us would prefer you not change the code we are using,  
thanks).  You can certainly extend it to get the api you want.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Squeak-dev mailing list