From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone"
Date: Mon, 22 Feb 2021 16:55:18 +0100 [thread overview]
Message-ID: <s10k54$1nhh$1@gioia.aioe.org> (raw)
In-Reply-To: 0e88c615-6a53-4392-b83d-581c59473c88n@googlegroups.com
On 2021-02-22 15:20, Mehdi Saada wrote:
> I just intend to initialize the value once and done. It is a default value, not a dynamic predicate.
There are three categories of "once":
1. Once per compilation, static
2. Once per object instantiation, subtype/dynamic constraint
3. Once per object update
------
and any time any place, variable.
As J-P said, you can have whatever expressions in #1, just remove
discriminants.
In other cases you can add more discriminants and a constructing
function. E.g. replace
type T (L : Positive) is
A : S (0..L - 1);
end record;
with
type T (<>) is private;
function Create (L : Positive) return T;
private
type T (L : Positive; Upper : Natural) is
A : S (0..Upper);
end record;
function Create (L : Natural) return T is
begin
return Result : T (L, L - 1) do
... -- Some initialization
end return;
end Create;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2021-02-22 15:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 0:14 "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone" Mehdi Saada
2021-02-22 6:32 ` J-P. Rosen
2021-02-22 10:14 ` AdaMagica
2021-02-22 10:57 ` Dmitry A. Kazakov
2021-02-22 14:20 ` Mehdi Saada
2021-02-22 15:11 ` J-P. Rosen
2021-02-22 15:55 ` Dmitry A. Kazakov [this message]
2021-02-22 16:21 ` Mehdi Saada
2021-02-23 22:06 ` Mehdi Saada
2021-02-24 9:59 ` AdaMagica
2021-02-24 10:04 ` Jeffrey R. Carter
2021-02-24 14:11 ` Simon Wright
2021-02-24 15:57 ` Shark8
2021-02-25 0:13 ` Mehdi Saada
2021-02-25 8:58 ` AdaMagica
2021-02-25 10:25 ` Mehdi Saada
2021-02-25 10:28 ` Mehdi Saada
2021-02-22 10:35 ` Jeffrey R. Carter
2021-02-22 14:21 ` Mehdi Saada
2021-02-22 15:02 ` Jeffrey R. Carter
2021-02-22 15:08 ` J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox