comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Min/Max attribute makes promises it can't keep
Date: Tue, 27 Apr 2010 17:46:29 -0500
Date: 2010-04-27T17:46:29-05:00	[thread overview]
Message-ID: <hr7pg7$n70$1@munin.nbi.dk> (raw)
In-Reply-To: wcczl0o7g13.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
news:wcczl0o7g13.fsf@shell01.TheWorld.com...
> Martin <martin.dowie@btopenworld.com> writes:
>
>>    Put (Positive (Positive'Min(Nat, Pos)));
>
> That works, but I think a qualified expression is better:
>
>   Put (Positive'(Positive'Min(Nat, Pos)));
>
> By the way, there are lots of attributes that work
> like this (use the base subtype).  It's not just Min
> and Max.

Right. Attributes mostly type-related, not subtype-related. The name in the 
prefix serves to identify the type, not the subtype (there are no named 
types in Ada, only named subtypes).

All of 'Succ, 'Pred, 'Val, and 'Value work this way, and there are probably 
many, many more. Even 'First and 'Last technically work this way (although 
it doesn't matter in that case).

                           Randy.





  reply	other threads:[~2010-04-27 22:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 19:34 Min/Max attribute makes promises it can't keep Alex Mentis
2010-04-27 20:20 ` Martin
2010-04-27 21:16   ` Robert A Duff
2010-04-27 22:46     ` Randy Brukardt [this message]
2010-04-28 10:36     ` Alex Mentis
2010-04-28 10:58       ` AdaMagica
2010-04-28 11:37         ` Gautier write-only
2010-04-28 11:47           ` AdaMagica
2010-04-28 13:28             ` Martin
2010-04-28 13:41             ` Dmitry A. Kazakov
2010-04-28 14:10               ` Georg Bauhaus
2010-04-28 14:53                 ` Dmitry A. Kazakov
2010-04-28 21:07                   ` Randy Brukardt
2010-04-28 22:17                     ` Dmitry A. Kazakov
2010-05-01  5:42                       ` Randy Brukardt
2010-05-01  6:28                         ` Dmitry A. Kazakov
2010-04-29  4:41                     ` AdaMagica
replies disabled

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