I don't really know the answer, but it is not about the implementation
in Association. It is reasonable for associations to be equal if both
their key & value are equal. The problem as you have seen is Float nan
does not compare using #=.
Float nan = Float nan --> false
I don't the details but perhaps the clue is in the implementation of isNaN
isNaN
"simple, byte-order independent test for Not-a-Number"
^ self ~= self
so something like this seems a better test
association := #foo -> Float nan.
{association} anySatisfy: [:each | each value isNaN]
cheers,
Mike
On Mon, Nov 15, 2010 at 3:06 PM, Benjamin
<[email protected]> wrote:
> Hi guys,
>
> I have another noob question :)
>
> Why Association>>#= is not
>
> = anAssociation
>
> ^self == anAssociation or: [super = anAssociation and: [value =
> anAssociation value]]
>
> Because I can have strange behavior like
>
> association := #foo -> Float nan.
>
> {association} includes: association
>
> answer false
>
> :S
>
>
> Thanks,
>
>
> Ben
>
> _______________________________________________
> Pharo-users mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users