comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: The "()" operator revisited.
Date: 12 Jan 2004 17:26:05 -0500
Date: 2004-01-12T17:26:05-05:00	[thread overview]
Message-ID: <wcck73w9536.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: raBMb.9128$Qq.7455@nwrdny01.gnilink.net

"Frank J. Lhota" <NOSPAM.lhota.adarose@verizon.net> writes:

> Last June, I proposed that in order to provide an abstract array capability,
> Ada 0y should support  user-defined "()" and "():="operators. Since this
> issue has come up again, I would like to summarize and expand on this
> proposal.

This is a good idea.  As you note below, it's got a long way to go
before you've got a list of wording changes to the RM.  For example, the
notion of operator-named *procedures* does not currently exist in Ada.
But before bothering with that, I think there are some important
issues to work out:

You seem to be saying that components of arrays (or just abstract
arrays?) are always passed by copy.  That seems like a real problem,
since for efficiency, most compilers pass large things by reference.
(I'm talking about the case of array-of-large-array or
array-of-large-record.)

Furthermore, if the component type is limited, it is *required* to be
passed by reference.  This raises the question: can "():=" be declared
for limited types?

What does A(I)'Access mean in this scheme?

Are there interactions with Adjust, which is normally called for
assignment of nonlimited controlled types?

You seem to treat 'out' parameters as copy-out only.  But for composite
types, 'out' means pretty much the same thing as 'in out' -- at least
*some* parts of the object are copied *in* (see RM for details).
Likewise, if the component type is an access type, you can't allow
undefined values to be created -- all access objects have to be
initialized to 'null' if they aren't initialized to something else
meaningful.

You seemed to be hoping that this new notation could underly the
definition of the *existing* array indexing semantics.  That would be
elegant.  However, some of the above issues mean it doesn't work -- at
least as you've defined it so far.

> Note: the following discussion probably has an insufficient amount of
> legalese to satisfy language lawyers. Once we've thrashed out these ideas,
> I'll be happy to work with anyone with formalizing this proposal.

I hate to be discouraging, but my guess is that a proposal like this is
*not* going to be accepted by the ARG, even if were written up as proper
RM wording changes.

> Similar declarations can be added to Ada.Strings.Bounded. This would permit
> the higher-level Ada string types to use the same notation as the low-level
> standard String type.

Well, it allows that for the particular notation of array indexing,
and that would be a good thing.  But it doesn't completely solve
the problem.  It doesn't support slice notation (but I don't think
slices are all that important).  And it doesn't support string literal
notation -- I think that *is* important -- it's really annoying that you
can't have a string literal of type uunbounded string.  Similarly, it
doesn't support aggregate notation.

If I were designing a language from scratch, I would allow user-defined
meanings for all of the above notations.  But as I said, unfortunately,
I don't see this happening for Ada 0X.

- Bob



  parent reply	other threads:[~2004-01-12 22:26 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-12 17:53 The "()" operator revisited Frank J. Lhota
2004-01-12 18:38 ` Frank J. Lhota
2004-01-12 22:26 ` Robert A Duff [this message]
2004-01-13 16:29   ` Frank J. Lhota
2004-01-13  9:24 ` Dmitry A. Kazakov
2004-01-13 16:44   ` Frank J. Lhota
2004-01-13 17:13     ` Hyman Rosen
2004-01-13 22:27     ` Randy Brukardt
2004-01-14  2:30     ` Stephen Leake
2004-01-14  9:04     ` Dmitry A. Kazakov
2004-01-17  0:15       ` Kenneth Almquist
2004-01-17 21:15         ` Robert A Duff
2004-01-19 10:25         ` Dmitry A. Kazakov
2004-01-13 13:13 ` Marin David Condic
2004-01-13 17:38   ` Warren W. Gay VE3WWG
2004-01-13 19:09     ` Robert A Duff
2004-01-15 17:30       ` Warren W. Gay VE3WWG
2004-01-15 18:11         ` Robert A Duff
2004-01-15 19:36           ` tmoran
2004-01-15 20:35             ` Robert A Duff
2004-01-17  5:48               ` Robert I. Eachus
2004-01-16  1:52           ` Redefining := (was: The "()" operator revisited.) Jeffrey Carter
2004-01-16 21:37             ` Randy Brukardt
2004-01-19 11:33               ` Dmitry A. Kazakov
2004-01-16  3:11           ` The "()" operator revisited Mark A. Biggar
2004-01-16 13:28             ` Hyman Rosen
2004-01-16 16:19             ` Robert A Duff
2004-01-16 18:09             ` Warren W. Gay VE3WWG
2004-01-16 13:56           ` Frank J. Lhota
2004-01-16 16:14             ` Robert A Duff
2004-01-16 21:29               ` Frank J. Lhota
  -- strict thread matches above, loose matches on Subject: below --
2004-01-13 17:46 amado.alves
2004-01-13 22:21 ` Randy Brukardt
2004-01-13 17:53 amado.alves
2004-01-14  9:09 ` Dmitry A. Kazakov
2004-01-14 12:55   ` Georg Bauhaus
2004-01-14 15:05     ` Dmitry A. Kazakov
2004-01-15  1:21       ` Georg Bauhaus
2004-01-15  8:50         ` Dmitry A. Kazakov
2004-01-15 11:09           ` Georg Bauhaus
2004-01-15 13:23             ` Dmitry A. Kazakov
2004-01-17  6:26               ` Robert I. Eachus
2004-01-14 13:04   ` Hyman Rosen
2004-01-14 15:22 amado.alves
2004-01-14 16:16 ` Dmitry A. Kazakov
replies disabled

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