From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: formal array types and default values
Date: Tue, 2 Jan 2018 18:52:11 -0600
Date: 2018-01-02T18:52:11-06:00 [thread overview]
Message-ID: <p2h9fr$6ji$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: faqhpnFljnfU1@mid.individual.net
"Niklas Holsti" <niklas.holsti@tidorum.invalid> wrote in message
news:faqhpnFljnfU1@mid.individual.net...
> On 17-12-30 23:42 , Mehdi Saada wrote:
>> I have several questions more or less related.
>
>> First: why aspect DEFAULT_COMPONENT_VALUE can apply only
>> to components of scalar type ?
>
> Don't know. Perhaps the thought was that if the component is a record
> type, then there is already a way to give default values to the components
> of the record type.
Correct; we didn't want multiple ways of doing the same thing.
> However, the AARM explains that this is a representation attribute, and
> why that is so, and (therefore?) requires the default component value to
> be defined by a /static/ expression, which means that it can only be a
> scalar or a string. In principle, a string might define the default
> component value of an array with elements of a constrained String subtype,
> but that is probably not a very common case.
Correct again. We did worry a bit about there not being a good way to set a
default for an array of arrays, but we decided those aren't very common and
the default can always be set for the ultimate (non-array) element type.
>> It would be nice to be able to set a default value to an array type
>> in a generic package, equal to a generic object parameter.
>
> Agreed. Possibly this case was forgotten, or prevented by such a generic
> object parameter not being a static value.
Not really. All of these defaults for for a *type*, not a subtype, so there
is only one per type. (There are thorny semantic problems with per-subtype
defaults, we decided they were not worth the trouble.) Thus, it wouldn't
make sense to specify it for generic formal parameters, as presumably the
actual type already has such a default (and if it doesn't, you can't add one
in the generic unit).
Randy.
next prev parent reply other threads:[~2018-01-03 0:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-30 21:42 formal array types and default values Mehdi Saada
2017-12-30 22:20 ` Niklas Holsti
2017-12-30 23:59 ` Mehdi Saada
2018-01-03 0:52 ` Randy Brukardt [this message]
2018-01-03 8:33 ` Niklas Holsti
2018-01-03 20:53 ` Randy Brukardt
2018-01-06 0:10 ` Niklas Holsti
2018-01-08 21:12 ` Randy Brukardt
2017-12-31 12:34 ` Jeffrey R. Carter
2017-12-31 14:55 ` Mehdi Saada
2018-01-03 15:47 ` Mehdi Saada
2018-01-03 21:16 ` Randy Brukardt
2018-01-04 15:02 ` Mehdi Saada
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox