From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Primitive subprogram for a subtype? Date: Mon, 21 Aug 2017 14:50:15 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:47764 Date: 2017-08-21T14:50:15+02:00 List-Id: 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