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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-11 00:28:38 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters Date: Thu, 11 Dec 2003 09:33:06 +0100 Message-ID: References: NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1071131317 797846 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:3353 Date: 2003-12-11T09:33:06+01:00 List-Id: On 10 Dec 2003 18:00:31 -0500, Robert A Duff wrote: >Here, I think you're talking about regular private types in >packages (as opposed to generic formals). One idea is to say: > > type T is private; > function "="(X, Y: T) return Boolean is abstract; > >Then clients can't call predefined "=". > >(But predefined "=" reemerges in generics! And records.) > >I've also done things like this (in the visible part): > > type T is private; > > function Predefined_Equal(X, Y: T) return Boolean renames "="; > -- For use only in the package body! > > function "="(X, Y: T) return Boolean is abstract; > >Unfortunately, the Ada compiler does not understand the comment, "-- For >use only in the package body!". You say above, ``with the capability of >defining "=" for either type.'' But it's not trivial to make that "=" >be the predefined one. Sticking to implemetation inheritance is the actual problem. Why do not we have true abstract interfaces? For example: type Can_Do_Nothing is ; type Can_Only_Compare is ; function "=" (X, Y : Can_Only_Compare) return Boolean is abstract; type Can_Copy_Assign_Compare is ; function "=" (X, Y : Can_Copy_Assign_Compare) return Boolean is abstract; ... Then an integer without predefined arithmetic could be an implementation of Can_Copy_Assign_Compare via private inheritance from Integer : type My_Number is new private Can_Copy_Assign_Compare; private type My_Number is new Integer; -- Regards, Dmitry Kazakov http://www.dmitry-kazakov.de