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: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public From: nospam@thanks.com.au (Don Harrison) Subject: Re: Interface/Implementation (was Re: Design by Contract) Date: 1997/09/09 Message-ID: #1/1 X-Deja-AN: 270859772 Sender: news@syd.csa.com.au References: Reply-To: nospam@thanks.com.au X-Nntp-Posting-Host: dev50 Organization: CSC Australia, Sydney Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-09-09T00:00:00+00:00 List-Id: Patrick Doyle wrote: :In article , :Don Harrison wrote: :>Patrick Doyle wrote: :> :>:In article , :>:Don Harrison wrote: :>:> :>:>Because they serve different purposes. (See my previous post). :>: :>:But the deferred class can serve both purposes, can't it? :> :>Not in the Ada or Modula sense of the term "interface". I expect the situation :>is made somewhat confusing by different nomenclature. Equating Eiffel deferred :>classes with Java "interfaces" may make sense, for example. (Not sure as :>I'm not a Java expert.) But in terms of the Ada/Modula idea of interfaces :>(which is the context of this discussion - separate interface and implementation), :>deferred classes are not the correct analogue. : : Ok, let's boil this down to two questions: : :1. What is the purpose of short forms/Ada interfaces? To provide visibility information to a client and the compiler about a class's exported features. That is, it documents the client relation. By comparison, the purpose of deferred classes is to specify what functionality will be provided by descendants of a class. That is, it documents the inheritance relation. This purpose is orthogonal to that of visibility. We may declare, for example, a deferred class which exports nothing. Such a class doesn't have much of client relation with client classes but does have an inheritance relation with its descendants. :2. Why can't deferred classes accomplish this purpose? The issue is clouded a bit by the fact that deferred classes *contain* visibility information. So, if you attempt to emulate Ada package specs using deferred classes, you're not using deferred classes per se to do it, but their export aspects. :>For example, consider an effective class which inherits only from effective :>classes. There is no deferred class in this situation, so you obviously can't :>use one as an interface. But, clearly, the class *does* have an interface and :>we see it exists as the short form. I dismiss as nonsensical the notion that :>a deferred class can be the analogue in one situation and the short form in :>another. : :Well, before you dismiss it, let me make a case for a very similar :situation... : :If you want to look at the whole interface of a class, you can use :Eiffel's "short" tool to extract it. What the short tool produces is :code which is, effectively, the deferred class which would correspond :to the effective class in question (except that it is missing the :word "deferred" in certain places). I disagree, the short form is not code, but documentation. As such, they can't be regarded as the same thing. [..] :>Also, this example shows that it's false to claim that deferred classes can do :>all that separate interfaces (or short forms) can do. : :I haven't yet seen you describe just what an interface or short form *does*. See above. :>Something that may further help to cement the difference is to consider that :>a deferred class has a short form and hence has an interface in the Ada/Modula :>sense. If the deferred class itself is an interface, how can it also have :>its *own* interface? This would be a meta-interface - a nonsensical concept. : :I think this still makes sense. The short form is only missing the :word "deferred" (and some other trivial syntactical niceties) in the :appropriate places. Add these back in, and the resulting deferred :class is exactly the same as the original class. Thus, the class *is* :its interface. I think there are some non-trivial, semantic niceties that make a difference. :) [..] :Well, thanks for your patient attempts to persuade me :-) but I'm still :a bit puzzled... Hope this has helped. Don. (Reverse to reply) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Don Harrison au.com.csa.syd@donh