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=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.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: Possible to recover default value of scalar type? Date: Wed, 16 Dec 2020 18:45:17 -0600 Organization: JSA Research & Innovation Message-ID: References: <0c0ddb8e-6a82-473d-8143-f4076242f520n@googlegroups.com> <86r1ntntb3.fsf@stephe-leake.org> <0ded905f-94ac-4470-936c-7f1cb19ac798n@googlegroups.com> <82e629ea-bd59-417a-9185-dd6094e396c1n@googlegroups.com> <570e9d30-0b33-45f0-a9fe-163cc810a770n@googlegroups.com> Injection-Date: Thu, 17 Dec 2020 00:45:19 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="29383"; 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:60871 List-Id: "Niklas Holsti" wrote in message news:i3re1oF5omrU1@mid.individual.net... > On 2020-12-15 3:27, Randy Brukardt wrote: >> "AdaMagica" wrote in message >> news:570e9d30-0b33-45f0-a9fe-163cc810a770n@googlegroups.com... >>> Dmitry A. Kazakov schrieb am Montag, 14. Dezember 2020 um 10:38:42 >>> UTC+1: >>>> procedure Library_Foo (Bar : Baz := Baz'Default_Value) >>> Suppose type Baz has no default value aspect. Then a call Library_Foo >>> without parameter would use what? >>> A solution could be that the attribute is illegal if there is no aspect. >>> The compiler knows. >> >> Not always. Never forget generics. One would hope to be able to use this >> on >> generic formal types, as most of them are going to have default values >> (at >> least in new code). > > > The generic formal type declarations could be extended to indicate that a > Default_Value is required, for example: > > generic > type T is private with Default_Value; Sure, but more complication. We (as a group) decided it wasn't worth it. I'd rather extend <> anyway, and that would be allowed anywhere, much like a raise_expression. Randy.