comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Language Lawyer question
Date: 2000/06/02
Date: 2000-06-02T00:00:00+00:00	[thread overview]
Message-ID: <yec1z2fr6zs.fsf@king.cts.com> (raw)
In-Reply-To: 8h97q3$68b$1@hobbes2.crc.com

"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:
> Wes Groleau <wwgrol@ftw.rsc.raytheon.com> wrote in message
> news:39380CEB.2CC4682E@ftw.rsc.raytheon.com...
> > One of my coworkers just asked an interesting question:
> >
> >    Why do we have to write
> >       Some_Type'Pred (Some_Value)
> >    when
> >       Some_Value'Pred
> >    is more natural/intuitive and
> >    carries just as much type info?

The grammar for an attribute reference is
     attribute_reference ::= prefix'attribute_designator
where
     prefix ::= name | implicit_dereference

Of course, that doesn't really answer the question; the grammar could
have been defined to allow an arbitrary expression as a prefix.  I
suppose it was defined that way for the sake of clarity, to prevent
expressions from becoming overly complex.

> What is 0'Pred?

If it were legal, it should be the same as 0 - 1 -- which means the
resolution would depend on the context.  (Note that the equivalence
between Foo'Pred and Foo - 1 wouldn't apply to enumeration types.)

> But, how would you do the equivalent of Modular_Type'Pred (0)
> with your syntax?

(Modular_Type'(0))'Pred

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Welcome to the last year of the 20th century.




  reply	other threads:[~2000-06-02  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-02  0:00 Language Lawyer question Wes Groleau
2000-06-02  0:00 ` Paul Graham
2000-06-02  0:00 ` David C. Hoos, Sr.
2000-06-02  0:00   ` Keith Thompson [this message]
2000-06-04  0:00     ` Robert I. Eachus
2000-06-05  0:00       ` Robert A Duff
2000-06-05  0:00     ` Robert Dewar
2000-06-05  0:00   ` Robert A Duff
replies disabled

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