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!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Possible to recover default value of scalar type? Date: Tue, 15 Dec 2020 11:30:31 +0200 Organization: Tidorum Ltd 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net h+ONv455OLZXrpEBDdZvEw02CCy7shOAacnzSW8O9oY6aR+Kus Cancel-Lock: sha1:deqpnXIaO1+mllmotR7/9AGut88= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:60865 List-Id: 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; ...