comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: abstract types and subprograms
Date: Tue, 20 May 2014 12:27:49 -0400
Date: 2014-05-20T12:27:49-04:00	[thread overview]
Message-ID: <wccsio4beka.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: llff8f$cql$1@speranza.aioe.org

Victor Porton <porton@narod.ru> writes:

> But does it make sense (philosophically, not accordingly the current 
> specification) to use a function which returns an abstract type for a record 
> extension aggregate?

Yes, it makes sense to create objects of an abstract type,
and the most likely place to use such a thing is as the 
ancestor part in an extension aggregate.  So this rule could
be relaxed.

What should be forbidden is to convert such an object to a class-wide
type (explicitly or implicitly), because that can lead to dangling
dispatch (i.e. calling an abstract subprogram, which of course
has no body).

Other languages that don't clearly distinguish specific and
class-wide types have to forbid creating objects of abstract type,
and I guess Ada just copied that.

> In my humble opinion, this use may be useful in a future Ada standard.

I mentioned this idea to Tucker once, and as I recall he didn't much
like it, but I'm not sure why.

- Bob


  reply	other threads:[~2014-05-20 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 10:22 abstract types and subprograms Victor Porton
2014-05-20 10:51 ` mockturtle
2014-05-20 11:45   ` Victor Porton
2014-05-20 16:27     ` Robert A Duff [this message]
2014-05-20 19:52       ` Dmitry A. Kazakov
2014-05-24 18:49         ` Robert A Duff
2014-05-24 19:41           ` Dmitry A. Kazakov
2014-05-20 11:55 ` Dmitry A. Kazakov
2014-05-20 12:28   ` Victor Porton
2014-05-20 14:11     ` 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