Rainer Deyke, el 17 de octubre a las 14:24 me escribiste: > Christopher Wright wrote: > > Rainer Deyke wrote: > >> It seems that Eiffel had 'old' semantics that I've proposed all along. > >> Any significant problems with this approach would have been discovered > >> by the Eiffel community by now. > > > > It requires duplicating the object. If the object is mutable, this > > requires duplicating it and recursively duplicating everything it > > references. If the object is immutable, this is free. > > There is no "the object". > > void f(string fname) out { > file_size(fname) >= old(file_size(fname)); > }
There is an object if you have this: void f(SomeObjectWithLotsOfReferences obj) out { assert(old(obj).some_check()); } But I don't see why the only option is too recursively copy the entire object. You can do a shallow copy too. It's a little more error prone since the programmer need to ensure that all needed "old" references are kept, but it's realistic. And you have the exact same problem with the ugly-nasty-oh-please-don't-do-it-like-that associative array of variant approach too =) So, if you *really* think that this "old stuff" is needed for contracts, I prefer the old() approach than the ugly-nasty-...-that associative array of variant =P -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Me encanta el éxito; por eso prefiero el estado de progreso constante, con la meta al frente y no atrás. -- Ricardo Vaporeso. Punta del Este, Enero de 1918.