comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Possible to recover default value of scalar type?
Date: Wed, 16 Dec 2020 18:45:17 -0600	[thread overview]
Message-ID: <rre9mu$sm7$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: i3re1oF5omrU1@mid.individual.net

"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message 
news:i3re1oF5omrU1@mid.individual.net...
> 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;

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.


  reply	other threads:[~2020-12-17  0:45 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
2020-12-17  0:45               ` Randy Brukardt [this message]
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