Interval bugs are well shared 3

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Interval bugs are well shared 3

Nicolas Cellier-3

Hi guys, once upon a time equality was transitive.

Try this one:

        | i1 i2 eps |
        eps := 1.0d0 timesTwoPower: -52.
        i1 := 100 to: 102.1d0 by: 1+eps.
        i2 := 100 to: 102.1d0 by: 1.
        (Array
                with: i1 asArray = i2 asArray
                with: i1 asArray = i1
                with: i2 asArray = i2
                with: i1 asArray = i2) , (Array
                with: i2 asArray = i1
                with: i1 = i2).

or more simply this one:

        (1 to: 0) = (2 to: 1).
        (1 to: 0) = #().
        (2 to: 1) = #().


Not having solid math in Smalltalk core library is like having sand in
the building foundation...

Squeak has pending patches for these. Why not VW?

Nicolas

Reply | Threaded
Open this post in threaded view
|

Re: Interval bugs are well shared 3

Andre Schnoor
nicolas cellier wrote:
[...]
> or more simply this one:
>
>     (1 to: 0) = (2 to: 1).
>     (1 to: 0) = #().
>     (2 to: 1) = #().
>
> Not having solid math in Smalltalk core library is like having sand in
> the building foundation...

Intervals in Smalltalk aren't vectors (or durations, spans, whatever).
They are rather used as abtractions for iterations. I wouldn't do any
math or even comparison with them. In any case, (1 to: 2) is NOT equal
to (1 to: 0). Both intervals denote different collections of integers.

Andre

Reply | Threaded
Open this post in threaded view
|

Re: Interval bugs are well shared 3

Nicolas Cellier-3
Andre Schnoor a écrit :

> nicolas cellier wrote:
> [...]
>> or more simply this one:
>>
>>     (1 to: 0) = (2 to: 1).
>>     (1 to: 0) = #().
>>     (2 to: 1) = #().
>>
>> Not having solid math in Smalltalk core library is like having sand in
>> the building foundation...
>
> Intervals in Smalltalk aren't vectors (or durations, spans, whatever).
> They are rather used as abtractions for iterations. I wouldn't do any
> math or even comparison with them. In any case, (1 to: 2) is NOT equal
> to (1 to: 0). Both intervals denote different collections of integers.
>
> Andre
>
>

Maybe you are right but only half right.

You are contradicted by (1 to: 0) = #() being true.

Cheers

Reply | Threaded
Open this post in threaded view
|

Re: Interval bugs are well shared 3

Nicolas Cellier-3
In reply to this post by Andre Schnoor
Andre Schnoor a écrit :

> nicolas cellier wrote:
> [...]
>> or more simply this one:
>>
>>     (1 to: 0) = (2 to: 1).
>>     (1 to: 0) = #().
>>     (2 to: 1) = #().
>>
>> Not having solid math in Smalltalk core library is like having sand in
>> the building foundation...
>
> Intervals in Smalltalk aren't vectors (or durations, spans, whatever).
> They are rather used as abtractions for iterations. I wouldn't do any
> math or even comparison with them. In any case, (1 to: 2) is NOT equal
> to (1 to: 0). Both intervals denote different collections of integers.
>
> Andre
>
>

Oh, and by the way, my point is not (1 to: 2) but (2 to: 1).

Both (1 to: 0) and (2 to: 1) are empty.

I know Interval are also used to indicate cursor position and text
selection, and this could be a good reason for (1 to: 0) not being equal
to (2 to: 1) - they represent a different cursor position.

However, in this case, it's hard to be consistent with the point of view
of the collection of integers, and the equality with empty array...

Both semantics contradict.

Nicolas

Reply | Threaded
Open this post in threaded view
|

Re: Interval bugs are well shared 3

Alexander Lazarevic'
In reply to this post by Andre Schnoor
Andre Schnoor schrieb:
> Intervals in Smalltalk aren't vectors (or durations, spans, whatever).
> They are rather used as abtractions for iterations.

Then at least to me interval seems to be a bad name for something that
isn't an interval...

Alex