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: Wed, 28 Apr 2010 16:07:24 -0500
Date: 2010-04-28T16:07:24-05:00	[thread overview]
Message-ID: <hra82e$i18$1@munin.nbi.dk> (raw)
In-Reply-To: 1t4extnm6iluj.r4x652cntogc$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1t4extnm6iluj.r4x652cntogc$.dlg@40tude.net...
> On Wed, 28 Apr 2010 16:10:46 +0200, Georg Bauhaus wrote:
>
>> On 28.04.10 15:41, Dmitry A. Kazakov wrote:
>>
>>> Well, the proposal might be to fix rather the issue of the superfluous
>>> subtype specification. Obviously Max (and many other attributes) are
>>> primitive operations and need no subtype to specify. So:
>>>
>>>     X'Succ, X'Pred, X'Image
>>
>> That'll be fun:
>>
>> C'Succ'Succ
>>
>> 'C'&'&''Succ
>>
>> ''''Succ
>>
>> (M + N)'Succ
>
> This is a slightly different design flaw. Things like "abc"'Length,
> "abc"'First are illegal in Ada. No fun!

That's not a real problem. Ada 2012 will allow

    String'("abc")'Length

As a qualified expression can be used as a name (it's considered constant).

If you think this is weird, Tucker points out that you can already write:

   String(String'("abc"))'Length

in Ada 95, as a type conversion is a name. We did wonder if any compilers 
could actually handle it, but given that this long-winded locution is 
already legal, the shorter one might was well be legal as well.

As for the initial concern about giving a subtype name, in the case of 
literals you have to give one somewhere (since a literal can be of many 
different types, and the results can vary depending on the type used -- not 
for 'Length, but for 'Last and most other properties).

We did talk a bit about object attributes like suggested back a few messages 
for Ada 2012. We didn't get much consensus, mainly because I think people 
were looking at the wrong questions.

                            Randy.





  reply	other threads:[~2010-04-28 21:07 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
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 [this message]
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