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,f66d11aeda114c52 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public From: nospam@thanks.com.au (Don Harrison) Subject: Re: Design By Contract Date: 1997/09/03 Message-ID: #1/1 X-Deja-AN: 269723213 Sender: news@syd.csa.com.au X-Nntp-Posting-Host: dev50 References: Organization: CSC Australia, Sydney Reply-To: nospam@thanks.com.au Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-09-03T00:00:00+00:00 List-Id: Jon S Anthony wrote: :In article nospam@thanks.com.au (Don Harrison) writes: [..] :> However, the good thing about Eiffel is that it gives designers the :> flexibility of exposing as much or as little of an object's :> structure, in contrast with with Ada's you-see-it-all or :> you-see-nothing export policy. I realised after writing this that you can export as much or as little as you like in Ada. In terms of individual attributes, you can do this by supplying a function if you want to export an attribute and by not supplying one if you want to hide one. :Second, you can play the same game in Ada anyway: Agree. :package P is : : type T is limited private; : : type S1 is tagged record : ... : end record; : : type S2 is ... end record; : : type Whatever is private; : : function Op1 (X : T) return S1; -- Expose S1 substructure : : function Op2 (X : T) return S2; -- Expose S2 substructure : : function Op3 (X : T) return Whatever; -- Don't expose this bit : :.... :private :.... :end P; Presumably, T here is composed of S1 and S2 among other things. I agree it gives similar functionality to Eiffel. :Also, even here, you it is possible to get at the remaining hidden :structure if it is in the private portion with child packages. Agree. BTW, I've just re-read the stuff on child packages (public and private) in the Ada95 Rationale. It's making more sense and I can see a couple of places in our recently completed simulation where private child packages would have been useful. They would have been handy for decomposing a couple of large abstractions into components while not exposing the internal interfaces to outsiders. I still prefer the Eiffel mechanisms for a couple reasons: a) Simpler b) Views may be directed to specific clients but it does seem to hold together pretty well. Also, it appears you can acheive comparable export granualarity in Ada and Eiffel. Don. (Reverse to reply) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Don Harrison au.com.csa.syd@donh