comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Possible to recover default value of scalar type?
Date: Mon, 14 Dec 2020 17:31:29 +0100	[thread overview]
Message-ID: <rr840u$1qm6$1@gioia.aioe.org> (raw)
In-Reply-To: 570e9d30-0b33-45f0-a9fe-163cc810a770n@googlegroups.com

On 2020-12-14 16:56, AdaMagica wrote:
> 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?

The default used by the compiler in this:

    declare
       Bar : Baz;
    begin

with an appropriate warning of course.

[ It was a language design bug to allow implicitly uninitialized 
variables in the first place. Declarations like above should have been 
illegal. ]

> A solution could be that the attribute is illegal if there is no aspect. The compiler knows.

I would argue that if

    declare
       Bar : Baz;
    begin

is legal, then it must be logically equivalent to:

    declare
       Bar : Baz := Baz'Default_Value;
    begin

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2020-12-14 16:31 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 [this message]
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
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