[bug] deepCopy on Dictionary doesn't work.

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

[bug] deepCopy on Dictionary doesn't work.

Robin Redeker-2
Issue status update for
http://smalltalk.gnu.org/node/87
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/87

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  Unassigned
 Reported by:  elmex
 Updated by:   elmex
 Status:       active

Reproduce with:

st> (Dictionary from: {'a' -> 1}) deepCopy
Object: 1 error: did not understand #key
MessageNotUnderstood(Exception)>>signal
SmallInteger(Object)>>doesNotUnderstand: #key
Dictionary>>findElementIndex:
Dictionary(HashedCollection)>>addWhileGrowing:
[] in Dictionary(HashedCollection)>>deepCopy
[] in Dictionary>>do:
Dictionary(HashedCollection)>>do:
Dictionary>>do:
Dictionary(HashedCollection)>>deepCopy
UndefinedObject>>executeStatements
nil




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] deepCopy on Dictionary doesn't work.

Paolo Bonzini
Issue status update for
http://smalltalk.gnu.org/project/issue/87
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/87

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
-Assigned to:  Unassigned
+Assigned to:  bonzinip
 Reported by:  elmex
 Updated by:   bonzinip
-Status:       active
+Status:       reviewed
 Attachment:   http://smalltalk.gnu.org/files/issues/gst-dictionary-deepcopy.patch (736 bytes)

Fixed with the attached patch.  It copies both keys and values.  Do you
reckon it would be better to only copy values?

st> (Dictionary from: {'a' -> 1}) deepCopy keys anyOne == 'a'
false
st> (Dictionary from: {'a' -> 1}) deepCopy keys anyOne = 'a'
true




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] deepCopy on Dictionary doesn't work.

S11001001
In reply to this post by Robin Redeker-2
Issue status update for
http://smalltalk.gnu.org/project/issue/87
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/87

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  bonzinip
 Reported by:  elmex
 Updated by:   S11001001
 Status:       reviewed

I would rather it copy keys, in the spirit of hardcore #deepCopy.  One
can always aDictionary collect: [:v | v copy].  Of course I am not
elmex. :)




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] deepCopy on Dictionary doesn't work.

Paolo Bonzini
In reply to this post by Robin Redeker-2
Issue status update for
http://smalltalk.gnu.org/project/issue/87
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/87

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  bonzinip
 Reported by:  elmex
 Updated by:   bonzinip
 Status:       reviewed

On the other hand one could say that for collections deepCopy *is*
"aDictionary collect: [:v | v copy]"...




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: [bug] deepCopy on Dictionary doesn't work.

Paolo Bonzini
In reply to this post by Robin Redeker-2
Issue status update for
http://smalltalk.gnu.org/project/issue/87
Post a follow up:
http://smalltalk.gnu.org/project/comments/add/87

 Project:      GNU Smalltalk
 Version:      <none>
 Component:    Base classes
 Category:     bug reports
 Priority:     normal
 Assigned to:  bonzinip
 Reported by:  elmex
 Updated by:   bonzinip
-Status:       reviewed
+Status:       fixed

I committed patch-583, *not* copying keys after asking some people
around.  It turns out that copying keys is more likely to screw up
users of IdentityDictionaries.




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk