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.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public From: doylep@ecf.toronto.edu (Patrick Doyle) Subject: Re: Interface/Implementation (was Re: Design by Contract) Date: 1997/09/10 Message-ID: #1/1 X-Deja-AN: 271167835 X-Nntp-Posting-Host: skule.ecf Sender: news@ecf.toronto.edu (News Administrator) References: Organization: University of Toronto, Engineering Computing Facility Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-09-10T00:00:00+00:00 List-Id: In article , Don Harrison wrote: > >Patrick Doyle wrote: > >: 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. Ok, I agree with that. >By comparison, the purpose of deferred classes is to specify what functionality >will be provided by descendants of a class. ...which includes visibility information. (Just for the record. :-) >That is, it documents the inheritance >relation. This purpose is orthogonal to that of visibility. I think this seems to be using a pretty loose definition of "orthogonal". Inheritance can be inheritance of interface and/or inheritance of implementation. Interface inheritance means inheriting visibility information. Orthogonal means that anything achieved using one technique cannot be achieved using the other. But specifying implementation (ie. the client relationship) can be accomplished by inheritance, so I'm not clear on how these are orthogonal. (Perhaps I'm mistaken about what "orthogonal" means? I'm going on recollections of a book I read a while back.) >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. Couldn't you also have an empty package spec? >: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. Ok. I'll go for that, because my argument all along has been that abstract superclasses can do as much as *and more than* Ada specs. So let's consider just the export aspects of an abstract class. Is there anything that they can't do which Ada specs can do? >: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. The Short tool could very easily be modified to put the word "deferred" in the right places and produce actual code. Does this change so fundamentally alter the resulting file that they are now "orthogonal" to each other? IMO clearly it doesn't. >: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. :) Ok, we can agree to disagree on this, but either way, it seems to me that the fact remains that there's nothing that Ada specs can do that Eiffel's deferred classes can't do. -PD -- -- Patrick Doyle doylep@ecf.utoronto.ca