why no "old" operator in function postconditions, as in Eiffel?

David B. Held dheld at codelogicconsulting.com
Thu Jun 28 23:43:06 PDT 2007


Bruno Medeiros wrote:
> [...]
> Well, yeah, if you only want old to work automatically for primitive 
> types, then D itself wouldn't need to know how to clone. But if there 
> will still be cases which need manual dups, then maybe its not worth it, 
> versus the joined in-out scope alternative (where you have to manually 
> dup any old you wish to check).

Not only that, but the type under consideration would have to *be* 
clonable.  D doesn't have first-class copy c'tors yet, but the ability 
to hide them would mean that some types would be non-copyable.  Of 
course, one could just say at that point that you either get a bitwise 
copy or you can't use the old operator on those variables.  But the 
"old" operator seems fairly non-trivial in any case.

Dave



More information about the Digitalmars-d mailing list