comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: subprogram must not be deeper than access type
Date: Mon, 26 Sep 2011 20:41:05 -0400
Date: 2011-09-26T20:41:05-04:00	[thread overview]
Message-ID: <wccy5xa95r2.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1uqthqxzri6j3.i18ifhbwmzdc.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Mon, 26 Sep 2011 12:15:51 -0400, Robert A Duff wrote:
>
>> The flaw I was referring to was that Ada doesn't have that equivalence.
>> Making an access type anonymous invokes all sorts of magical semantics,
>> which is confusing.  If such magical semantics are desirable, they
>> should be invoked by some other syntax.  (And by the way, I don't think
>> run-time accessibility checks are desirable.  That's another design flaw.)
>
> Yes, it would be much simpler to have subprogram types for downward
> closures.

Yes, "not null access procedure" is annoying when I really mean
"procedure".

>> Another flaw is that some types can be anonymous (task, protected,
>> array, access) and some can't.  It should be all or nothing.
>
> I'd like to have anonymous types in record components. It is annoying not
> to be able to write:
>
>    type Foo is record
>        Nested : record
>           end record;
>        List : array (...) of ...;
>    end record;
>
> Even C can this!

Yes.  But it's not a big deal.

>> And it's just weird that if you say "X, Y : array...;"
>> "X := Y;" and "if X = Y ..." are illegal.  Textual replacement is
>> a wrong way to define semantics.
>
> But structural type matching is more wrong than that.

Mostly true.  But if the opposite of "structural typing"
is "by name", then it makes no sense.  There's no name for
that type, here.

>>> I think that the problem is that access types to automatically collected
>>> objects and access types to the objects allocated and freed dynamically
>>> should be different, if the former could not be eliminated at all.
>> 
>> Not sure what you mean by "automatically collected".  Local to a
>> procedure?  Or are you talking about garbage collection?  What
>> about library-package-body variables?  What about components
>> of variables?
>
> E.g. things on the stack.
>
>> Ada 83 required all access values to point to heap-allocated objects.
>> Ada 95 added "access all", which allows pointing at any aliased object.
>> That's sort of similar to the distinction you're making, I think.
>
> Yes. There should be:
>
> 1. Strictly heap access types, manually allocated/deallocated, no
> accessibility checks, no calls to Finalize outside Unchecked_Deallocation.

Not even when the access type is finalized?

> I would even provide a built-in operation Free for them.

Yes, good idea.

> 2. References to aliased objects, shaped more like "X renames Y", fully
> statically checked.

OK.

> 3. "Access all" for emergency cases.

Yeah, we have that one now.

- Bob



  reply	other threads:[~2011-09-27  0:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-25  9:02 subprogram must not be deeper than access type Natasha Kerensikova
2011-09-25 14:04 ` Oliver Kleinke
2011-09-26  9:35   ` Natasha Kerensikova
2011-10-03 23:30   ` Yannick Duchêne (Hibou57)
2011-10-03 23:39     ` Adam Beneschan
2011-10-04  0:52       ` Yannick Duchêne (Hibou57)
2011-10-04  1:48         ` Yannick Duchêne (Hibou57)
2011-09-25 14:23 ` Robert A Duff
2011-09-25 15:03 ` georg bauhaus
2011-09-26  9:45   ` Natasha Kerensikova
2011-09-26 13:43     ` Robert A Duff
2011-09-26 14:20       ` Dmitry A. Kazakov
2011-09-26 16:15         ` Robert A Duff
2011-09-26 19:30           ` Dmitry A. Kazakov
2011-09-27  0:41             ` Robert A Duff [this message]
2011-09-27  8:58               ` Dmitry A. Kazakov
2011-10-04  4:19               ` Yannick Duchêne (Hibou57)
2011-09-27  5:50             ` J-P. Rosen
2011-09-27  7:52               ` Dmitry A. Kazakov
2011-10-04  4:26                 ` Yannick Duchêne (Hibou57)
2011-10-04  7:58                   ` Dmitry A. Kazakov
2011-10-04 15:10                     ` Georg Bauhaus
2011-10-04 15:34                       ` Dmitry A. Kazakov
2011-10-04 15:49                         ` Yannick Duchêne (Hibou57)
2011-10-04 16:04                           ` Dmitry A. Kazakov
2011-10-04 15:44                       ` Yannick Duchêne (Hibou57)
2011-10-04 16:05                         ` Georg Bauhaus
2011-10-04 16:47                           ` Yannick Duchêne (Hibou57)
2011-10-04 15:41                     ` Yannick Duchêne (Hibou57)
2011-09-26 18:59       ` Jeffrey Carter
2011-09-27  0:35         ` Robert A Duff
2011-10-04  4:30         ` Yannick Duchêne (Hibou57)
2011-10-04 18:40           ` Jeffrey Carter
2011-09-26 14:29     ` Georg Bauhaus
2011-09-26 15:31       ` Georg Bauhaus
2011-10-04  4:35       ` Yannick Duchêne (Hibou57)
2011-10-04  4:13     ` Yannick Duchêne (Hibou57)
2011-09-25 17:16 ` Jeffrey Carter
2011-09-25 21:53   ` Robert A Duff
2011-09-26  9:25     ` Georg Bauhaus
2011-09-26 23:00     ` Randy Brukardt
2011-09-27  0:34       ` 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