Thanks norbert.
You see this was a kind of exercise… to see if people can get a bit more 
involved.
I could have simply introduce the fix but I want people to understand that 
there are a lot 
of little trivial things that can get done and it will help the system.

So thank :)
:)


On Nov 5, 2011, at 11:20 AM, Norbert Hartl wrote:

> And I would rather like to see another implementation like
> 
> < aMagnitude 
>       "Answer whether the receiver is less than the argument."
> 
>       (self size = aMagnitude size) ifFalse: [ 
>               ^ self size < aMagnitude size ].
>       1 to: self size do: [:i |
>               (self at: i) = (aMagnitude at: i) ifFalse: [
>                       ^ (self at: i) < (aMagnitude at: i) ]].                 
>       ^false.
> 
> Norbert
> 
> Am 04.11.2011 um 21:13 schrieb Stéphane Ducasse:
> 
>> I was thinking that we should get the same bug for you UUID
>> because the code right now is 
>> 
>> < aMagnitude 
>>      "Answer whether the receiver is less than the argument."
>> 
>>      1 to: self size do: [:i |
>>              (self at: i) < (aMagnitude at: i) ifTrue: [^true]].
>>      ^false.
>> 
>> 
>>>> |a b|
>>>> a := UUID fromString: '0608b9dc-02e4-4dd0-9f8a-ea45160df641'.
>>>> b := UUID fromString: 'e85ae7ba-3ca3-4bae-9f62-cc2ce51c525e'.
>>>> (a > b) = (b > a)
>> 
>> returns true and this looks wrong :)
>> 
>> What do you think?
>> 
>> Stef
>> 
>> 
>> Begin forwarded message:
>> 
>>> From: Alan Knight <[email protected]>
>>> Subject: Re: [vwnc] UUID Sorting Incorrect
>>> Date: November 1, 2011 3:19:23 PM GMT+01:00
>>> To: Runar Jordahl <[email protected]>
>>> Cc: [email protected]
>>> Reply-To: [email protected]
>>> 
>>> Thanks. Created AR 64162
>>> 
>>>> 
>>>> Runar Jordahl
>>>> 25 October, 2011 7:13 AM
>>>> 
>>>> 
>>>> Class UUID is included in beta in VisualWorks 7.8. It seems like #< is
>>>> implemented incorrect. If you evaluate the statement below it answers
>>>> true:
>>>> 
>>>> |a b|
>>>> a := UUID fromString: '0608b9dc-02e4-4dd0-9f8a-ea45160df641'.
>>>> b := UUID fromString: 'e85ae7ba-3ca3-4bae-9f62-cc2ce51c525e'.
>>>> (a > b) = (b > a)
>>>> 
>>>> The fix is to change the method to this:
>>>> 
>>>> < aMagnitude
>>>> "Answer whether the receiver is less than the argument. Add an
>>>> initial size check, in anticipation of greater than 128-bit
>>>> Smalltalk-specific UUID type."
>>>> 
>>>> | ss ms |
>>>> 
>>>> ss := self size.
>>>> ms := aMagnitude size.
>>>> ss < ms
>>>> ifTrue: [^true]
>>>> ifFalse: [
>>>> ss > ms
>>>> ifTrue: [^false]
>>>> ifFalse: [
>>>> 1 to: self size do: [:i |
>>>> (self at: i) < (aMagnitude at: i) ifTrue: [^true].
>>>> (self at: i) > (aMagnitude at: i) ifTrue: [^false]].
>>>> ^false]]
>>>> 
>>>> 
>>>> Runar Jordahl
>>>> blog.epigent.com
>>>> _______________________________________________
>>>> vwnc mailing list
>>>> [email protected]
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>>> _______________________________________________
>>> vwnc mailing list
>>> [email protected]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>> 
> 


Reply via email to