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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,772ae8afc5db35f2 X-Google-Attributes: gid103376,public From: nospam@thanks.com.au (Don Harrison) Subject: Re: Can't export object of private type Date: 1999/03/10 Message-ID: #1/1 X-Deja-AN: 453297222 Sender: news@syd.csa.com.au X-Nntp-Posting-Host: dev7 References: Organization: CSC Australia, Sydney Reply-To: nospam@thanks.com.au Newsgroups: comp.lang.ada Date: 1999-03-10T00:00:00+00:00 List-Id: Matt Heaney wrote: :nospam@thanks.com.au (Don Harrison) writes: :> .. What I :> really want is an abstract primitive operation, not so much for :> polymorphism, but so that derivations are forced to supply an access :> function to their (private) variable "Self". This is a form of :> contract which derivations must meet. : :You can't enforce this using the type system. I'm beginning to believe that. :( :This is like declaring a type, and then trying to have an operation that :forces clients to declare instances of the type. Huh??? Not at all. It's nothing like that. The nature of the inheritance relation is completely different from the client relation. Whereas a client should *optionally* use a supplier (including declaring instances of it), a derivation should be *forced* to honour its parent's contract; otherwise, polymorphism breaks. :> Got you. There are two opposing needs here: :> :> a) On the other, it's convenient for all private declarations :> to be in the one place (rather than being split between private :> part of spec and body).... : :I would declare the instance in the body. The reason is that there :might be other abstractions that are needed by the instance. : :If you declare the instance in the spec, then you'll have to move those :with's into the spec too, which can cause unnecessary recompilations. Sure. -- Don (Harrison). donh at syd.csa.com.au