From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:6e12:: with SMTP id d18-v6mr3810106ioh.16.1527378062313; Sat, 26 May 2018 16:41:02 -0700 (PDT) X-Received: by 2002:a9d:5543:: with SMTP id h3-v6mr709275oti.13.1527378062181; Sat, 26 May 2018 16:41:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!v8-v6no3701157itc.0!news-out.google.com!f20-v6ni3412itd.0!nntp.google.com!u74-v6no3677085itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 26 May 2018 16:41:01 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.113.16.86; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.113.16.86 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1eea4fd5-c370-4c5d-b2bd-ea8e22922146@googlegroups.com> Subject: Re: why "unconstrained subtype in component declaration" while said component given default value ? From: Shark8 Injection-Date: Sat, 26 May 2018 23:41:02 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2515 X-Received-Body-CRC: 3808432645 Xref: reader02.eternal-september.org comp.lang.ada:52708 Date: 2018-05-26T16:41:01-07:00 List-Id: On Saturday, May 26, 2018 at 3:03:23 PM UTC-6, Mehdi Saada wrote: > Hello. > Why is this case not allowed ? Is there really an implementation issue here ? I doubt so. Why should it be any different from the non-issue of initializing variables of unconstrained subtypes vs declaring uninitialized variables of constrained subtypes ? > type A (N: Positive) is record > II : Integer; > Chaine : String := Give_String(N); > end record; It is allowed; try: type A (N: Positive) is record II : Integer; Chaine : String(1..N) := Give_String(N); end record; (This assumes the output-size of Give-string is length N.) > > Also, there's something that would be really cool, and I'm curious why it could not be allowed: Why can't we provide a private constrained subtype, of an inconstrained private type ? > > package III is > type A (<>) is private; > subtype B is A; -- should be a constrained subtype > private > function Donne_String (N : Positive) return String; > type A (N: Positive) is record > II : Integer; > Chaine : String(1..N) := Give_String(N); > end record; > end III; What's the use-case for this?