On Fri, 11 Jun 2010, Marcus Denker wrote:

First update from the Brussels Sprint

11390
-----

Issue 2516:     UTF16TextConverter broken in Pharo 1.1?
Issue 2530:     Morph duplicate failing
Issue 2469:     Debugger simulation problems
Issue 2532:     HashedCollection>>like: is missing

According to the method comment, #like: was not ment to be sent to dictionaries:

"Answer an object in the receiver that is equal to anObject,
nil if no such object is found. Relies heavily on hash properties"

What should happen when #like: is sent to a dictionary:
According to the comment the method should return an object in the receiver or nil. If it's not nil then that should be an association (or any object in case of MethodDictionary, but most likely a CompiledMethod). The comment also says that the argument of the method has to be equal to the returned object. This means that the argument has the be an association if the dictionary is not a MethodDictionary.

What's actually happening:
d := Dictionary new
        at: #foo put: 1;
        at: #bar put: 2;
        yourself.
d like: #foo -> 1. "===> nil" "Oops"
d like: #foo. "===> #foo->1" "Oops"
d associationAt: #foo ifAbsent: nil. "===> #foo->1"

Now with MethodDictionary:
d := Object methodDict.
d like: #yourself. "===> (Object>>#yourself ""a CompiledMethod(489160704)"")" 
"Oops"
d like: Object >> #yourself. "===> nil" "Oops"
d associationAt: #yourself. "(Object>>#yourself ""a CompiledMethod(489160704)"")" 
"Oops, it's a bug."

So I think:
- MethodDictionary >> #associationAt:ifAbsent: should be fixed
- GOODS and Glorp implementations should use #associationAt:ifAbsent: instead 
of #like:
- Dictionaries shouldn't understand #like:


Levente



--
Marcus Denker  -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to