[GAP] old attribute
Robert Dewar
dewar at adacore.com
Fri Oct 28 17:41:29 CEST 2011
On 10/28/2011 11:35 AM, Dick Gayler wrote:
> I am using ada in an upper division course covering design by contract.
> Specifically, I am using the precondition and postcondition pragmas. As
> is typical in academia, I am "going overboard" to emphasize the
> concepts. The problem that I have run across is that is seems that the
> implementation of the old attribute makes a shallow copy of the object
> leading to the obvious problems with linked structures. Has anyone
> looked at what has to be done so that the old attribute when make a deep
> copy? I am trying to avoid explicitly putting the "deep copy" code in
> the subprograms.
Interesting, obviously this cannot be done automatically since what
a "deep copy" means is very data structure dependent, I guess what
you would need is a user defined attribute function something like
for typ'Old use subprogram
where subprogram has the profile
function typ'Old (Arg : typ) return typ;
Definitely an interesting suggestion.
>
> Thank you.
>
More information about the GAP
mailing list