Without knowing the context of what you want to do, I would suggest
just overriding veryDeepCopy on MagmaCollection to say something like:
veryDeepCopy
| mc |
mc := MagmaCollection new.
self do: [ : each | mc add: each veryDeepCopy ].
^ mc
If any of the elements reference back to the receiver collection then
another solution would be needed.
But MagmaCollections are typically used in situations where they would
have a lot of elements, and veryDeepCopy would require a full
enumeration, which means it would not perform well. If it does not
have a lot of elements then a standard Smalltalk collection
could/should be used. So, I am curious why you want to veryDeepCopy a
MagmaCollection..
- Chris
On Sat, Jan 7, 2012 at 7:47 AM, Milan Mimica <
[hidden email]> wrote:
> Hello!
>
> Aiming to complete transparency, it would be really nice if one could send
> #veryDeepCopy to an instance of MagmaCollection (or some object containing
> it) and get a fresh new MagmaCollection with all the elements deeply copied
> to it. By default it won't work because 'session' instance variable must not
> be deeply copied.
> As far I understand, one should override #veryDeepInner: and maybe
> #veryDeepFixupWith: to shallow-copy 'sessoin', and deep-copy everything
> else, and probably do something more to clear references to the collection
> begin copied.
>
> I did try to do it, but the semantics of Pharo deep-copy are just too
> confusing for me. I keep getting "unknown OID" error from magma server.
>
> I must be doing something wrong.
> Any advices, or code? :)
>
>
> --
> Milan Mimica
>
http://sparklet.sf.net>
> _______________________________________________
> Magma mailing list
>
[hidden email]
>
http://lists.squeakfoundation.org/mailman/listinfo/magma>
_______________________________________________
Magma mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/magma