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!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.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: formal array types and default values Date: Tue, 2 Jan 2018 18:52:11 -0600 Organization: JSA Research & Innovation Message-ID: References: <053b2370-5c15-4662-a9e3-e1464de206a1@googlegroups.com> Injection-Date: Wed, 3 Jan 2018 00:52:12 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="6770"; 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:49722 Date: 2018-01-02T18:52:11-06:00 List-Id: "Niklas Holsti" wrote in message news:faqhpnFljnfU1@mid.individual.net... > On 17-12-30 23:42 , Mehdi Saada wrote: >> I have several questions more or less related. > >> First: why aspect DEFAULT_COMPONENT_VALUE can apply only >> to components of scalar type ? > > Don't know. Perhaps the thought was that if the component is a record > type, then there is already a way to give default values to the components > of the record type. Correct; we didn't want multiple ways of doing the same thing. > However, the AARM explains that this is a representation attribute, and > why that is so, and (therefore?) requires the default component value to > be defined by a /static/ expression, which means that it can only be a > scalar or a string. In principle, a string might define the default > component value of an array with elements of a constrained String subtype, > but that is probably not a very common case. Correct again. We did worry a bit about there not being a good way to set a default for an array of arrays, but we decided those aren't very common and the default can always be set for the ultimate (non-array) element type. >> It would be nice to be able to set a default value to an array type >> in a generic package, equal to a generic object parameter. > > Agreed. Possibly this case was forgotten, or prevented by such a generic > object parameter not being a static value. Not really. All of these defaults for for a *type*, not a subtype, so there is only one per type. (There are thorny semantic problems with per-subtype defaults, we decided they were not worth the trouble.) Thus, it wouldn't make sense to specify it for generic formal parameters, as presumably the actual type already has such a default (and if it doesn't, you can't add one in the generic unit). Randy.