comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: Re: Question on variant/discriminated records
Date: Thu, 31 Dec 2020 04:57:28 -0800 (PST)	[thread overview]
Message-ID: <8357b686-38f0-41c6-ab29-6b453e32e092n@googlegroups.com> (raw)
In-Reply-To: <ba97a48d-6e75-49e8-8a62-a5dea3c6189cn@googlegroups.com>

Approaching :-) But the interpretation of (the meaning of) r.y could in principle be 
calculated on the fly (when called) based on the received discriminant -
but arguments related to  security/reliability  are against?

Maybe nice to find errors at compile time as compared to experiencing costly runtime errors :-)

reinert

torsdag 31. desember 2020 kl. 13:46:47 UTC+1 skrev gautier:
> On Thursday, December 31, 2020 at 1:24:25 PM UTC+1, reinert wrote: 
> > Here must be a hole in my understanding. I thought that the discriminant must be known 
> > before V.Y := 1.0; and hence there should be no confusion?
> Imagine you have a function Evaluate (r : rec1_Type) return Float. 
> Except in trivial cases like 
> if r.option1 = b then result := result + r.y; end if; 
> the compiler cannot guess the value of the discriminant.

  reply	other threads:[~2020-12-31 12:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 10:38 Question on variant/discriminated records reinert
2020-12-31 10:52 ` J-P. Rosen
2020-12-31 12:24   ` reinert
2020-12-31 12:46     ` Gautier write-only address
2020-12-31 12:57       ` reinert [this message]
2020-12-31 13:29       ` DrPi
2020-12-31 16:06         ` Gautier write-only address
2020-12-31 15:03 ` Dmitry A. Kazakov
2021-01-01  9:19   ` reinert
replies disabled

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