comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Making guarantees about record components
Date: Tue, 19 Nov 2013 15:57:22 -0700
Date: 2013-11-19T15:57:22-07:00	[thread overview]
Message-ID: <l6gqci$lrk$1@dont-email.me> (raw)
In-Reply-To: <l6gbro$1oc$1@loke.gir.dk>

On 11/19/2013 11:49 AM, J Kimball wrote:
>
> I'm trying to guarantee that two record component values map to the same
> value of another type.
>
> type A is (...);
> type C is (...);
>
> M : array (A) of C := (...);
>
> type R is record
>     A1 : A;
>     A2 : A;
> end record
>     with Dynamic_Predicate => (M (R.A1) = M (R.A2) );
>
> Is this the best solution we have as of Ada 2012?

If you really want to guarantee that the property always holds, this doesn't do 
that. Changes to components of variables of type R, and changes to M, may 
invalidate the predicate but not be detected until later. To really guarantee 
the property, you'd have to encapsulate M and all instances of R so that all 
such changes can be checked.

-- 
Jeff Carter
"There's no messiah here. There's a mess all right, but no messiah."
Monty Python's Life of Brian
84


  parent reply	other threads:[~2013-11-19 22:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 18:49 Making guarantees about record components J Kimball
2013-11-19 20:20 ` Anh Vo
2013-11-19 22:57 ` Jeffrey Carter [this message]
2013-11-20  9:36   ` Stephen Leake
2013-11-20 17:37     ` Jeffrey Carter
2013-11-21  6:53       ` Stephen Leake
2013-11-20 20:58   ` tmoran
2013-11-19 23:38 ` Shark8
2013-11-20  8:01   ` Dmitry A. Kazakov
2013-11-22  5:46 ` J Kimball
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox