Having a solid Design by Contract mechanism is notoriously difficult to have. What you can do, is to have a shallow copy for now. If necessary, you may have a bounded deep copy. But do not use #deepCopy. They are many objects where you cannot do a #deepCopy, because it will copy the whole image, and it does not handle cycles. Cheers, Alexandre
On Feb 29, 2016, at 8:31 AM, Alain Rastoul <alf.mmm.cat@gmail.com> wrote:
On 28/02/2016 20:59, Alexandre Bergel wrote:
Yes, that is a crucial point. This is a feature that having Object>>assert: aBlock cannot easily emulate Hi Alexandre yes it is possible, with the limitation pointed to by Stef: deep copy is a complex thing and I don't measure the implications. I can't figure out the result of a stack deep copy (ie a thiscontext object), thinking just about this one, they are others. May be DeepCopier would help ?
They are other situations leading to unpredictable results. (Object>>#value) ast link: ( MetaLink new metaObject: true; control: #after; arguments: #( ) ; selector: #value ) . hangs the vm immediatly -it's like sawing off the branch on which we are sitting. This situation that can be protected with a simple fencing mechanism (avoiding checking of some classes and/or methods), but more complex cases will show off.
More investigations are needed here, but even not perfect, this would still be a valuable tool IMHO
--
Alain
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.