From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:47c4:: with SMTP id d4mr10258393qtr.43.1596314132803; Sat, 01 Aug 2020 13:35:32 -0700 (PDT) X-Received: by 2002:ac8:47c8:: with SMTP id d8mr9276522qtr.32.1596314132613; Sat, 01 Aug 2020 13:35:32 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 1 Aug 2020 13:35:32 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:c7d:897d:6600:5498:9e97:399a:3ce0; posting-account=YRfoYAoAAADhSEO2nLYx10QUUvp8akYl NNTP-Posting-Host: 2a02:c7d:897d:6600:5498:9e97:399a:3ce0 References: <94a54092-a56f-4a99-aaec-08dd611c8fd8@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Proposal: Auto-allocation of Indefinite Objects From: Stephen Davies Injection-Date: Sat, 01 Aug 2020 20:35:32 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:59625 List-Id: On Saturday, 1 August 2020 at 13:58:10 UTC+1, Dmitry A. Kazakov wrote: > On 01/08/2020 13:22, Stephen Davies wrote: > > type Node_Type (<>) is record > > Item : Element_Type; > > Prev : Node_Ptr_Type; > > Next : Node_Ptr_Type; > > end record; > > The rules for such records would be the same as for discriminated ones, > > except that instead of usages needing to provide values for discriminants, > > they would need to provide values for indefinite components. > 1. There is no discriminants for cases when Item is T'Class. > 2. You cannot get discriminant from the value in the case of Rosen trick... > 3. Copying is involved. There should be none, especially for limited types... I'm mainly talking about situations in which there doesn't need to be a discriminant at all, e.g. when Element_Type is an indefinite non-limited generic parameter. In other words, Node_Type would then also be indefinite, but not discriminated. > Why not to make this legal? > X : T := ("hello!", 123); -- L is deduced from S Maybe that's something that should be fixed anyway, though this is indeed another situation that (both versions of) my proposal would address, by removing (the somewhat redundant) L altogether.