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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Discriminant of a limited type object Date: Tue, 27 Feb 2018 16:20:21 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Tue, 27 Feb 2018 22:20:22 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="22403"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50693 Date: 2018-02-27T16:20:21-06:00 List-Id: A defaulted discriminant for a limited type means just that: a default for the discriminant if the object is default initialized. It was always a mistake for Ada to tie that to mutability, but it doesn't matter for a limited type. You can initialize an array of limited discriminanted objects with an aggregate of function calls (since those are built-in-place), and they can all have different discriminant values. The "hole" is that you can't assign discriminants to tasks/protected objects easily, because there is no aggregate for them. You could use access-to-task to do that, but of course then you get the normal access type issues. Supposedly, you could use an aggregate iterator to do that, but I'm not sure how (perhaps there is a way with a nested record?) Randy. "Dmitry A. Kazakov" wrote in message news:p745vr$pma$1@gioia.aioe.org... > Never needed that, but it seems that there no way to change the > discriminant of a definite object of limited type because there is no > assignment. > > Say, we have an array of limited variant records with a defaulted > discriminant. Then there is no way to fill that array ever, because > element's discriminants are frozen. > > P.S. Yet another example why Ada needs proper constructors instead of > limited returns... > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de