Hi konrad in fact I introduced postCopy/copy long time ago and did not get the force to clean the deepCopy and veryDeepInner mess. This is something that one day we will have to do.
S > On 2 Jan 2021, at 12:17, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > > "Richard O'Keefe" <rao...@gmail.com> writes: > >> Well, when you talk about "THE copying machinery" you have to be a bit more >> specific. There is no such thing as #deepCopy or #shallowCopy in the ANSI >> Smalltalk standard. Many Smalltalks have > > I am referring only to Pharo, which is the only Smalltalk I have ever > used. > >> You will note that in Pharo, AtomicCollection, Behavior, Boolean, >> Character, Float, SmallFloat64, Form, ColorForm, Morph, Paragraph, >> Point, SmallInteger, String, UndefinedObject, and perhaps others >> override #deepCopy. > > Interesting. I didn't even consider this possibility because the comment > in Object>>#deepCopy says "should never be overridden". > >> #deepCopy is *serious* "Hic sunt dracones" territory. >> It's marked on the Hunt-Lenox Globe, just beside the >> Vesuvian introitus ad infernum. > > :-) That's more or less what I discovered in my recent debugging > experiment. > >> Seriously, the OOP way to do this is >> MyClass>>immutableSnapshot >> "Answer an immutable copy of myself." >> ... >> and then whatever it takes to make precisely that happen. > > In other words, implement my own variant of deepCopy. That's probably > the safest way to go, but it also means there is no extensible > copying infrastructure that everybody can build on. > > Konrad.