From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Primitive subprogram for a subtype?
Date: Mon, 21 Aug 2017 14:50:15 +0200
Date: 2017-08-21T14:50:15+02:00 [thread overview]
Message-ID: <oneku7$1jnt$1@gioia.aioe.org> (raw)
In-Reply-To: onejsp$1i5j$1@gioia.aioe.org
On 21/08/2017 14:32, Victor Porton wrote:
> Dmitry A. Kazakov wrote:
>
>> On 21/08/2017 00:45, Victor Porton wrote:
>>> Is it possible to define a primitive subprogram for a subtype rather than
>>> the base type?
>>
>> No, a subtype (Ada subtype) would have same tag.
>
> How is it related to having the same tag?
Because a primitive subprogram must have a unique slot in the
dispatching table. If tags are same dispatch cannot lead to different
bodies.
> I do NOT speak about defining a
> primitive subprogram for both the type and its subtype but for the subtype
> only.
A subtype is a type that inherits subprograms = considered substitutable
for its supertype. If it does not, then it is not a subtype in any
sense, including Ada's, Liskov's, whatever flavor of.
P.S. Considering non-primitive subprograms and non-tagged types. Ada
subtype is an "equivalent" type. It is both sub- and supertype of its
base type and all other subtypes of whatever subtypes and their subtypes
(a closure set). Thus anything you define on it is exported to the base
type and to all subtypes from this type equivalence class.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2017-08-21 12:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-20 22:45 Primitive subprogram for a subtype? Victor Porton
2017-08-21 7:08 ` Dmitry A. Kazakov
2017-08-21 12:32 ` Victor Porton
2017-08-21 12:42 ` Egil H H
2017-08-21 12:50 ` Dmitry A. Kazakov [this message]
2017-08-21 14:00 ` J-P. Rosen
2017-08-21 7:36 ` mockturtle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox