On Dec 9, 2012, at 7:24 PM, Igor Stasenko <siguc...@gmail.com> wrote:

> some years ago, its been a long discussion on squeak mailing list about that..
> imo association should compare keys. not values.
> 

But it's not very clear why? Why should 

        (1 -> 2) = (1 -> 4)

be true? They are not the same! 

If you want to compare keys, you can easily write 

        (1 -> 2) key = (1 -> 4) key

and the people reading the code will directly understand what your intention is.

        Marcus

> But self-referencing data structures is and will be a problem. And
> there is no easy solution:
> 
> a := Array new: 1.
> a at:1 put: a.
> 
> a = a
> 
> On 9 December 2012 17:20, Sven Van Caekenberghe <s...@stfx.eu> wrote:
>> I am not pro, see my comments in the issue tracker.
>> 
>> For example,
>> 
>> | a |
>> a := Association key: #foo.
>> (a value: (Array with: a)) = (a value: (Array with: a)).
>> 
>> would still loop.
>> 
>> Loops like that cannot be prevented locally.
>> 
>> See my other mail about prevent stack overflow.
>> 
>> On 09 Dec 2012, at 16:32, Stéphane Ducasse <stephane.duca...@inria.fr> wrote:
>> 
>>> Hi guys
>>> 
>>> what is the impact on method =?
>>> Any ideas?
>>> 
>>> Stef
>>> On Dec 8, 2012, at 5:57 PM, Ciprian Teodorov wrote:
>>> 
>>>> It seems that this issue can be fixed by modifying the = method in 
>>>> Association.
>>>> 
>>>> Association>>= anAssociation
>>>>     ^ super = anAssociation
>>>>             and: [
>>>>                     value == anAssociation value
>>>>                             ifTrue: [ true ]
>>>>                             ifFalse: [ value = anAssociation value ] ]
>>>> 
>>>> Cheers...
>>>> 
>>>> On Sat, Dec 8, 2012 at 5:35 PM, Benoit St-Jean <bstj...@yahoo.com> wrote:
>>>> Same behavior in Squeak 4.2 btw
>>>> 
>>>> -----------------
>>>> Benoit St-Jean
>>>> Yahoo! Messenger: bstjean
>>>> A standpoint is an intellectual horizon of radius zero.
>>>> (Albert Einstein)
>>>> From: Ciprian Teodorov <ciprian.teodo...@gmail.com>
>>>> To: Pharo-project@lists.gforge.inria.fr
>>>> Sent: Saturday, December 8, 2012 11:11:44 AM
>>>> Subject: Re: [Pharo-project] strange == behavior
>>>> 
>>>> by the way, we have the same thing in 1.0, 1.1, 1.3.
>>>> 
>>>> On Sat, Dec 8, 2012 at 5:10 PM, Ciprian Teodorov 
>>>> <ciprian.teodo...@gmail.com> wrote:
>>>> Hi guys,
>>>> 
>>>> Playing with some recursive data-structure I have found some strange piece 
>>>> of behavior in Pharo.
>>>> 
>>>> If in an workspace we try to evaluate:
>>>> 
>>>> a := Association new.
>>>> a key: 3.
>>>> a value: a.
>>>> a == a value.
>>>> 
>>>> the first time we get "true", the second we get an infinite loop...
>>>> 
>>>> A simple workaround is to declare "a":
>>>> 
>>>> |a|
>>>> a := Association new.
>>>> a key: 3.
>>>> a value: a.
>>>> a == a value.
>>>> 
>>>> My question now is: Is this a bug or a feature ?
>>>> By the way the same thing happens in 1.4 and 2.0 equally.
>>>> 
>>>> By the way, in Pharo 2.0 doing cmd + . erases the lines selected in the 
>>>> workspace replacing them by "."
>>>> 
>>>> Cheers,
>>>> --
>>>> Dr. Ciprian TEODOROV
>>>> Ingénieur Développement CAO
>>>> 
>>>> tél : 06 08 54 73 48
>>>> mail : ciprian.teodo...@gmail.com
>>>> www.teodorov.ro
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Dr. Ciprian TEODOROV
>>>> Ingénieur Développement CAO
>>>> 
>>>> tél : 06 08 54 73 48
>>>> mail : ciprian.teodo...@gmail.com
>>>> www.teodorov.ro
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Dr. Ciprian TEODOROV
>>>> Ingénieur Développement CAO
>>>> 
>>>> tél : 06 08 54 73 48
>>>> mail : ciprian.teodo...@gmail.com
>>>> www.teodorov.ro
>>> 
>>> 
>> 
>> 
> 
> 
> 
> -- 
> Best regards,
> Igor Stasenko.
> 


Reply via email to