From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:240e:b0:69f:6ab:4cd9 with SMTP id d14-20020a05620a240e00b0069f06ab4cd9mr18803963qkn.462.1651744753921; Thu, 05 May 2022 02:59:13 -0700 (PDT) X-Received: by 2002:a0d:ffc3:0:b0:2eb:2327:3361 with SMTP id p186-20020a0dffc3000000b002eb23273361mr23141678ywf.36.1651744753771; Thu, 05 May 2022 02:59:13 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 5 May 2022 02:59:13 -0700 (PDT) In-Reply-To: <0b4ddd38-1f19-44fe-acd9-43a316ec9d29n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=160.46.252.109; posting-account=mOyWBQoAAAD7S-NBmMUOr9hRClcL0vqR NNTP-Posting-Host: 160.46.252.109 References: <0b4ddd38-1f19-44fe-acd9-43a316ec9d29n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9487fad4-b59a-4b85-8010-07b66eb3d298n@googlegroups.com> Subject: Re: Discriminants or Constructor Function for Limited Types From: R R Injection-Date: Thu, 05 May 2022 09:59:13 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63814 List-Id: 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