From: Nick Roberts <nick.roberts@acm.org>
Subject: Re: Possible Ada deficiency?
Date: Sun, 9 Jan 2005 21:56:13 +0000
Date: 2005-01-09T21:56:13+00:00 [thread overview]
Message-ID: <gemini.ia2kxp009ql0r02vo.nick.roberts@acm.org> (raw)
In-Reply-To: wcchdlqo6gv.fsf@shell01.TheWorld.com
Robert A Duff <bobduff@shell01.TheWorld.com> wrote:
> ...
> The main thing I dislike about the Ada rule is that it is possible to
> write code by accident that behaves differently because one compiler
> chooses pass-by-copy and another one pass-by-reference. And it's not
> clear whose responsibility it is to worry about this kind of bug: should
> procedures be written so that they work even in the presence of aliasing
> among actual parameters? Or should callers avoid that aliasing? And what
> can the caller know about data modified in a procedure that raised an
> exception in the middle of processing?
>
> I also think it's kludgy to treat (say) integers differently from strings.
> I understand the efficiency reason for this, but I still don't like it.
Yes, I think this is one of the nastiest gotchas in Ada. It's even worse
that Ada is supposed to be a multitasking-friendly language.
> I can think of several solutions, but I'm not sure which is best. One idea
> is to define all parameter passing to be nominally by copy, but add some
> features that allow the compiler to know enough about global variables and
> whatnot, so that it can use by-reference in most cases, having proved it
> doesn't make any difference. That wouldn't work in Ada because the
> compiler doesn't have enough information to do the proof, in most cases.
A couple of facilities would help.
One would be a pragma that declared two parameters (of the same type) of a
subprogram unaliased. At each call, a static check would be made if
possible, otherwise code inserted to make a dynamic check (that the same
object had not been passed as the actual for both parameters). I suppose
this would be similar to an assertion or pre-condition.
The other would be a pragma that declared a subprogram non-reentrant. A flag
(global at the level of the declarative region immediately containing the
subprogram) would be set upon entry and reset on exit. Just before setting
the flag, a test would be made: if the flag is already set, raise an
exception. The compiler could catch obvious breaches (such as a recursive
call).
There could be a couple of checks associated with these pragmas, named
Aliasing_Check and Reentrancy_Check perhaps, for use by the Suppress pragma.
--
Nick Roberts
next prev parent reply other threads:[~2005-01-09 21:56 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-31 18:15 Possible Ada deficiency? danmcleran
2004-12-31 19:12 ` Jeffrey Carter
2005-01-01 1:52 ` danmcleran
2005-01-01 2:37 ` Jeffrey Carter
2005-01-01 2:02 ` danmcleran
2005-01-01 14:11 ` Martin Krischik
2005-01-01 15:27 ` danmcleran
2005-01-02 17:49 ` Martin Krischik
2005-01-01 15:30 ` Stephen Leake
2005-01-01 15:57 ` danmcleran
2005-01-03 23:37 ` Randy Brukardt
2005-01-07 17:26 ` Nick Roberts
2005-01-07 18:26 ` danmcleran
2005-01-07 21:32 ` Randy Brukardt
2005-01-08 3:56 ` Nick Roberts
2005-01-08 18:15 ` Robert A Duff
2005-01-08 19:11 ` Jeffrey Carter
2005-01-08 20:03 ` Robert A Duff
2005-01-09 3:40 ` Jeffrey Carter
2005-01-09 17:30 ` Robert A Duff
2005-01-09 19:24 ` Jeffrey Carter
2005-01-09 21:56 ` Nick Roberts [this message]
2005-01-10 13:47 ` Dmitry A. Kazakov
2005-01-10 16:46 ` Duncan Sands
2005-01-10 17:58 ` Pascal Obry
2005-01-10 18:45 ` Dmitry A. Kazakov
2005-01-10 19:44 ` Pascal Obry
2005-01-11 10:05 ` Dmitry A. Kazakov
2005-01-11 7:24 ` Vinzent 'Gadget' Hoefler
2005-01-11 9:48 ` Dmitry A. Kazakov
2005-01-11 13:57 ` Vinzent 'Gadget' Hoefler
2005-01-11 21:52 ` Robert A Duff
2005-01-12 11:22 ` Dmitry A. Kazakov
2005-01-09 17:23 ` danmcleran
2005-01-09 17:46 ` Robert A Duff
2005-01-10 3:05 ` danmcleran
2005-01-09 18:41 ` Nick Roberts
2005-01-09 19:06 ` Martin Krischik
2005-01-09 20:10 ` Robert A Duff
2005-01-09 20:15 ` Robert A Duff
2005-01-11 14:13 ` Possible Ada deficiency? (goto) Peter Hermann
2005-01-11 14:54 ` Nick Roberts
2005-01-11 22:15 ` Robert A Duff
2005-01-12 10:17 ` Peter Hermann
2005-01-15 17:34 ` Robert A Duff
2005-01-15 17:58 ` Dmitry A. Kazakov
2005-01-15 19:34 ` Robert A Duff
2005-01-10 20:15 ` Possible Ada deficiency? Randy Brukardt
2005-01-10 21:51 ` Robert A Duff
2005-01-11 20:23 ` Randy Brukardt
2005-01-11 21:24 ` Robert A Duff
2005-01-12 19:57 ` Randy Brukardt
2005-01-02 15:51 ` Adrian Hoe
2005-01-04 16:06 ` Peter Hermann
2005-01-01 23:36 ` tmoran
2005-01-02 3:38 ` danmcleran
2004-12-31 19:16 ` Martin Dowie
2005-01-01 2:32 ` Jeffrey Carter
2004-12-31 23:23 ` Nick Roberts
2005-01-01 1:56 ` danmcleran
2005-01-01 11:43 ` Dmitry A. Kazakov
2005-01-01 15:46 ` danmcleran
2005-01-01 17:58 ` Larry Kilgallen
2005-01-01 19:43 ` danmcleran
2005-01-02 0:36 ` Ed Falis
2005-01-02 3:36 ` danmcleran
2005-01-02 15:53 ` Ed Falis
2005-01-07 18:31 ` danmcleran
2005-01-07 18:44 ` Pascal Obry
2005-01-07 19:29 ` danmcleran
2005-01-07 21:28 ` Pascal Obry
2005-01-01 23:28 ` danmcleran
2005-01-02 10:26 ` Dmitry A. Kazakov
2005-01-02 15:51 ` danmcleran
2005-01-03 23:48 ` Randy Brukardt
2005-01-01 14:06 ` Martin Krischik
2005-01-01 15:53 ` danmcleran
2005-01-07 21:33 ` Robert A Duff
2005-01-09 17:15 ` danmcleran
2005-01-09 17:38 ` Robert A Duff
2005-01-10 3:16 ` danmcleran
2005-01-09 18:41 ` Martin Dowie
2005-01-10 3:18 ` danmcleran
2005-01-10 20:32 ` Randy Brukardt
2005-01-10 21:42 ` danmcleran
2005-01-10 21:36 ` Robert A Duff
2005-01-10 21:44 ` danmcleran
2005-01-09 19:01 ` Jeffrey Carter
2005-01-10 3:20 ` danmcleran
2005-01-10 22:16 ` Robert A Duff
2005-01-10 22:29 ` danmcleran
2005-01-11 20:12 ` Georg Bauhaus
2005-01-11 20:30 ` danmcleran
2005-01-11 21:44 ` Robert A Duff
2005-01-11 0:06 ` Jeffrey Carter
2005-01-11 0:46 ` Robert A Duff
2005-01-11 20:37 ` danmcleran
2005-01-11 21:08 ` Robert A Duff
2005-01-17 4:40 ` Tucker
2005-01-18 13:46 ` danmcleran
2005-01-18 21:29 ` Nick Roberts
2005-01-24 17:23 ` danmcleran
-- strict thread matches above, loose matches on Subject: below --
2004-12-31 19:06 danmcleran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox