comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Subtype predicates
Date: Wed, 24 Aug 2016 14:54:20 -0700
Date: 2016-08-24T14:54:20-07:00	[thread overview]
Message-ID: <npl52j$4t8$1@dont-email.me> (raw)
In-Reply-To: <68b89d71-dd92-4b9c-adb9-476a7caa64cf@googlegroups.com>

On 08/24/2016 06:06 AM, AdaMagica wrote:
> Am Dienstag, 23. August 2016 22:14:30 UTC+2 schrieb Anh Vo:
>> type Human_Life_Span_Type is range 0 .. 130 
>>   with Default_Value => Human_Life_Span_Type'First;
> 
> No, I think it's the rule that the name of the entity declared in a declaration (here Human_Life_Span_Type) may not be used again in the same declaration. (You cannot use something that is to be defined recursively in the definition.)
> 
> I just cannot find the RM chapter and verse.

No, it's because of ARM 13.1.1(12/3): "If the associated declaration is a
type_declaration, within the aspect_definition ... the name of the first subtype
denotes the current instance of the type (see 8.6)." For a declaration:

V : Human_Life_Span_Type;

the current instance is V, so this says V's default value is V'First. Since you
can't apply 'First to a scalar object, the aspect is in error.

-- 
Jeff Carter
"He had no conception of the instrument. He
was blowing into it."
Take the Money and Run
135


  parent reply	other threads:[~2016-08-24 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 20:14 Subtype predicates Anh Vo
2016-08-24 13:06 ` AdaMagica
2016-08-24 16:45   ` Shark8
2016-08-24 21:18     ` Anh Vo
2016-08-24 21:32       ` Shark8
2016-08-24 21:54   ` Jeffrey R. Carter [this message]
2016-08-25  0:08     ` Shark8
2016-08-25  0:31       ` Jeffrey R. Carter
2016-08-25 17:28         ` Anh Vo
2016-08-31 18:16       ` Randy Brukardt
2016-09-01  8:09         ` J-P. Rosen
2016-09-01 20:02           ` Randy Brukardt
2016-09-01 20:16         ` Shark8
replies disabled

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