comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Bug in Ada (SuSe 10.2) ?
Date: Mon, 25 Feb 2008 18:32:54 -0600
Date: 2008-02-25T18:32:54-06:00	[thread overview]
Message-ID: <fpvn0n$l8i$1@jacob-sparre.dk> (raw)
In-Reply-To: d8a465d3-9eae-480b-954f-93236e3a6203@s19g2000prg.googlegroups.com

<billjones6789@yahoo.com> wrote in message
news:d8a465d3-9eae-480b-954f-93236e3a6203@s19g2000prg.googlegroups.com...
On Feb 22, 11:52 am, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
>> These aren't "dangling pointer" checks (which would occur on the
>> dereference). If you wanted to talk about them informally, I'd call them
>> "lifetime" checks, but it is best to call them by their real name (which
you
>> finally did above). I thought you were talking about something completely
>> different.

>Sorry to confuse you.  Maybe my English is not so good.
>I was referring to this language-defined check by its high-level purpose
>rather than its low-level implementation model, the same way it is
>introduced in RM 3.10.2 paragraph 1, "The accessibility rules prevent
>dangling references ...".

I spend so much time in the language-lawyer cave (which requires only formal
terminology) that I can get confused by informal terminology -- especially
that which is not used in the standard. (Yes, I realize you found a mention
of it in a non-normative introduction paragraph, but of course I hardly ever
read those...)

>> Anyway, accessibility checks contain both a static and dynamic part, and
it
>> is fairly difficult to write an interesting program that passes the
static
>> check and fails the dynamic check.

>I provided what I thought to be a rather simple example program that
>demonstrated the dynamic case.  Do you mean to say that this example is
>fairly difficult to use in an interesting program?

I've completely forgotten your original point (or mine, for that matter), so
I'm probably babbling at this point.

You are using anonymous access parameters to achieve the effect. You are
quite correct that this is easy to do. That is in fact the problem: it is
easy to get a Program_Error from passing the "wrong" thing to a subprogram
that has an anonymous access parameter. Moreover, there is no way to
indicate in the specification what is required. Contrast this to parameters
that will be used as array indexes -- the specification ought to include the
appropriate range, in which case any check will take place at the call site
(and the error will be immediately obvious).

On top of that, the use of access parameters (rather than "in" or "in out")
clutters up the call site: both with a 'access and with "aliased"
declarations. Plus, there is a substantial runtime overhead for them
compared to named access types (where the checks are mainly static).

Thus, I believe that they should be avoided if at all possible. (I admit
that there are a few cases where they can't be avoided.) Indeed, a good ADT
should not contain the keyword "access" anywhere in the visible part - the
memory management of the top-level objects should be left to the client.

Net-net I tend to forget about the accessibility checks on anonymous access
parameters, because if you encounter them you probably are doing something
bad (using anonymous access parameters). Of course, all of this is personal
stylistic preferences; it is legal within the language.

Anyway, I'm pretty sure this is getting wildly off-topic.

                                    Randy.









  reply	other threads:[~2008-02-26  0:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19  8:47 Bug in Ada (SuSe 10.2) ? Reinert Korsnes
2008-02-19  9:08 ` Niklas Holsti
2008-02-19  9:53   ` Reinert Korsnes
2008-02-19 11:21     ` Ludovic Brenta
2008-02-20 12:41       ` Reinert Korsnes
2008-02-20 16:50         ` Adam Beneschan
2008-02-20 18:31           ` Jeffrey R. Carter
2008-02-20 23:10             ` Adam Beneschan
2008-02-20 23:22             ` Adam Beneschan
2008-02-21  0:31               ` Randy Brukardt
2008-02-21  8:56                 ` Jean-Pierre Rosen
2008-02-21  9:08                   ` Alex R. Mosteo
2008-02-21  9:27                     ` Ludovic Brenta
2008-02-21  9:46                       ` billjones6789
2008-02-21 12:27                         ` Access type (mis)use (Was: Bug in Ada (SuSe 10.2) ?) Jacob Sparre Andersen
2008-02-21 19:40                           ` Bob Klungle
2008-02-21 21:25                             ` Jeffrey R. Carter
2008-02-21 21:57                             ` Vadim Godunko
2008-02-21 22:32                         ` Bug in Ada (SuSe 10.2) ? Randy Brukardt
2008-02-22 16:10                           ` billjones6789
2008-02-22 19:21                             ` Georg Bauhaus
2008-02-22 21:29                               ` Vadim Godunko
2008-02-22 21:39                                 ` Robert A Duff
2008-02-23 10:16                               ` billjones6789
2008-02-22 19:52                             ` Randy Brukardt
2008-02-23 10:36                               ` billjones6789
2008-02-26  0:32                                 ` Randy Brukardt [this message]
2008-02-26 16:46                                   ` billjones6789
2008-02-26 20:53                                     ` Randy Brukardt
2008-02-27  1:05                                     ` Robert A Duff
2008-02-27 10:06                                       ` billjones6789
2008-02-27 17:49                                         ` Robert A Duff
2008-02-28  0:30                                           ` Randy Brukardt
2008-02-28 15:33                                             ` Robert A Duff
2008-03-06 17:46                                             ` Adam Beneschan
2008-02-21  0:31               ` Jeffrey R. Carter
2008-02-21  0:35                 ` Jeffrey R. Carter
2008-03-06 11:55                   ` Colin Paul Gloster
2008-02-21  0:55               ` tmoran
2008-02-21  8:08                 ` billjones6789
2008-02-21  9:11                 ` Alex R. Mosteo
2008-02-21 23:01                   ` Randy Brukardt
2008-02-22 16:43                 ` Adam Beneschan
2008-02-22  9:06               ` Stephen Leake
2008-02-22  5:40       ` Gautier
replies disabled

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