On 29/02/2016 09:27, Alexandre Bergel wrote:
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.
Hi Alexandre
Thank you for your response, and sorry for responding late, I couldn't
take time, my bad.
Yes you are definitely right, design by contract implementation is
difficult, there is lot of papers and research done by brilliant people
on the subject, that's why I classified this work under POC on the
readme page of smalltalkhub.
I have no pretention to do a perfect dbc implmentation, I just want to
see at first stage if a simple implementation based on the MetaLink can
work.
And it currently works, with some limitations : no returned value
support, no old value support (for now), and some work to do on pragma
syntax (like postconditionOf: suggested by Stef).
I should be able to work on those points in few weeks.
About old value support, right, no doubt that deepCopy will not work,
but a shallow copy will certainly not pass checks too .
Experimenting with that I found Object>>veryDeepCopy with DeepCopier,
and that lot of classes implements veryDeepCopyWith: deepCopier
Also it seems that it handles several cases without hanging ...
Do you have any opinion or advices on that ?
Did you use it ?
Thanks
--
Alain