From: R R <rrr.eee.27@gmail.com>
Subject: Re: Discriminants or Constructor Function for Limited Types
Date: Thu, 5 May 2022 02:59:13 -0700 (PDT) [thread overview]
Message-ID: <9487fad4-b59a-4b85-8010-07b66eb3d298n@googlegroups.com> (raw)
In-Reply-To: <0b4ddd38-1f19-44fe-acd9-43a316ec9d29n@googlegroups.com>
R R schrieb am Mittwoch, 4. Mai 2022 um 11:02:56 UTC+2:
> There are two ways (to my knowledge) how to initialize objects of limited types. Either the limited type has some discriminants
>
> type DLT (Width, Length : Positive) is tagged limited private;
> Obj : DLT (3, 5);
>
> or I can provide a constructor function that takes corresponding parameters
>
> type LT (<>) is tagged limited private;
> function Make (Width, Length : Positive) return LT;
> Obj : LT := Make (3, 5);
>
> Do you recommend one way over the other? Why? Is it possible to combine both methods (discriminants plus constructor)?
>
> RREE
I finally went for the constructor function. A discriminant cannot be an array, at least that's what I understand from GNAT's error message. And I want to initialize the limited object with an array of config parameters.
Thanks for all the answers.
RREE
prev parent reply other threads:[~2022-05-05 9:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 9:02 Discriminants or Constructor Function for Limited Types R R
2022-05-04 9:40 ` Jeffrey R.Carter
2022-05-04 9:47 ` Dmitry A. Kazakov
2022-05-04 23:49 ` Randy Brukardt
2022-05-05 6:56 ` Dmitry A. Kazakov
2022-05-06 1:53 ` Randy Brukardt
2022-05-06 8:48 ` Dmitry A. Kazakov
2022-05-07 3:26 ` Randy Brukardt
2022-05-07 14:55 ` Dmitry A. Kazakov
2022-05-08 2:32 ` Randy Brukardt
2022-05-08 8:37 ` Dmitry A. Kazakov
2022-05-08 17:19 ` Doctor Who
2022-05-08 18:00 ` Dmitry A. Kazakov
2022-05-08 18:07 ` Doctor Who
2022-05-09 8:52 ` Niklas Holsti
2022-05-09 9:45 ` Dmitry A. Kazakov
2022-05-09 10:19 ` Doctor Who
2022-05-09 11:15 ` Dmitry A. Kazakov
2022-05-09 12:05 ` Doctor Who
2022-05-09 12:31 ` Dmitry A. Kazakov
2022-05-10 4:48 ` Randy Brukardt
2022-05-10 6:18 ` Dmitry A. Kazakov
2022-05-04 15:05 ` AdaMagica
2022-05-05 9:59 ` R R [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox