comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Possible to recover default value of scalar type?
Date: Tue, 15 Dec 2020 11:30:31 +0200	[thread overview]
Message-ID: <i3re1oF5omrU1@mid.individual.net> (raw)
In-Reply-To: <rr93ec$ko1$1@franka.jacob-sparre.dk>

On 2020-12-15 3:27, Randy Brukardt wrote:
> "AdaMagica" <christ-usch.grein@t-online.de> 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;

    ...





  reply	other threads:[~2020-12-15  9:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  9:54 Possible to recover default value of scalar type? reinert
2020-12-14  0:08 ` Stephen Leake
2020-12-14  6:09   ` reinert
2020-12-14  9:01     ` AdaMagica
2020-12-14  9:38       ` Dmitry A. Kazakov
2020-12-14 15:56         ` AdaMagica
2020-12-14 16:31           ` Dmitry A. Kazakov
2020-12-14 18:24             ` Simon Wright
2020-12-14 18:53               ` Dmitry A. Kazakov
2020-12-15  6:47                 ` J-P. Rosen
2020-12-15  7:23                   ` Dmitry A. Kazakov
2020-12-15  9:07                     ` J-P. Rosen
2020-12-15 16:53                       ` Simon Wright
2020-12-15 18:14                         ` AdaMagica
2020-12-17  0:53                           ` Randy Brukardt
2020-12-17  0:48                   ` Randy Brukardt
2020-12-15  1:27           ` Randy Brukardt
2020-12-15  9:30             ` Niklas Holsti [this message]
2020-12-17  0:45               ` Randy Brukardt
2020-12-15  1:26         ` Randy Brukardt
2020-12-15  7:35           ` Dmitry A. Kazakov
2020-12-17  0:43             ` Randy Brukardt
2020-12-15  1:21       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox