If it’s always been that way - and things rely on it, sure.

But it doesn’t feel like the Smalltalk way to me.

Having to know about adding -1 seems very C, whereas Smalltalk always seems 
more natural ... and 5 to: 1 seems like you would count down, not be an empty 
range and do nothing.

But as you say, it’s personal. I’m still curious though.

Tim

Sent from my iPhone

> On 22 Feb 2019, at 16:13, Konrad Hinsen <konrad.hin...@fastmail.net> wrote:
> 
>> On 22/02/2019 15:57, Tim Mackinnon wrote:
>> I've just been caught out with Intervals - why can't you do:
>> 5 to: 1 do: [ :i | Transcript show: i printString]  (eg a negative interval)?
>> 
>> if you want to iterate down a series of numbers do you really have to do:
>> 5 to: 1 by: -1 do: […
>> 
>> I always assumed that if x > y the step was automatically -1 (but its not).
> 
> Expectations are obviously personal, but as far as I am concerned, I'd expect 
> to see the behavior that Pharo implements. If you don't specify by:, you get 
> a default value of 1. That's much simpler than a default value depending on 
> the bounds of the interval.
> 
> Konrad.
> 
> 


Reply via email to