comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: abstract types and subprograms
Date: Tue, 20 May 2014 14:45:22 +0300
Date: 2014-05-20T14:45:22+03:00	[thread overview]
Message-ID: <llff8f$cql$1@speranza.aioe.org> (raw)
In-Reply-To: a24c0cf4-3e60-48b9-983d-768e0640622e@googlegroups.com

mockturtle wrote:
> On Tuesday, May 20, 2014 12:22:30 PM UTC+2, Victor Porton wrote:
> 
>> 
>> 
>> rdf-base.ads:20:04: function that returns abstract type must be abstract
>> gnatmake: "/home/porton/Projects/librdf-ada/rdf-base.adb" compilation
>> error
>> 
>> By the philosophy of programming From_Handle should be non-abstract but
>> return an abstract object, and From_Handle should be automatically
>> overridden for descendants non-abstract objects.
>> 
> 
> In my opinion, there is a contradiction: an abstract type is, by
> definition, a type "without objects," in the sense that you cannot have a
> value whose type is an abstract type.   Therefore, you cannot have a
> non-abstract function that returns an abstract type, since by calling it
> you would create a value of an abstract type.
> 
> Functions that return abstract types make sense.  For example, they can be
> used to "force" who derives from you abstract type to provide a
> constructor for the derived type.  I use them, for example, to implement
> "plugins" in order to have a standard constructor for the derived type.
> 
> I hope this can help you a bit.

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?

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

-- 
Victor Porton - http://portonvictor.org


  reply	other threads:[~2014-05-20 11:45 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 [this message]
2014-05-20 16:27     ` Robert A Duff
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