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: 103376,fa2cc518ef3b992c X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: tagged types extensions - language design question Date: 2000/01/28 Message-ID: #1/1 X-Deja-AN: 578806098 Content-transfer-encoding: 7bit References: <3891B5B3.7430F96B@earthlink.net> Content-Type: text/plain; charset="US-ASCII" X-ELN-Date: Fri Jan 28 08:29:22 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 949076962 38.26.192.12 (Fri, 28 Jan 2000 08:29:22 PST) Organization: EarthLink Network, Inc. Mime-version: 1.0 NNTP-Posting-Date: Fri, 28 Jan 2000 08:29:22 PST Newsgroups: comp.lang.ada Date: 2000-01-28T00:00:00+00:00 List-Id: In article <3891B5B3.7430F96B@earthlink.net> , Charles Hixson wrote: >> But you'd have the "additional package" in other OOP languages too. In >> another language you'd have to declare two "classes," which means two >> modules. Same as Ada. (Although I think you can nest classes in C++, >> right?) >> > > My understanding of Eiffel (not the greatest!) is that it would handle THIS > PROBLEM gracefully in one step. My problem with it is the lack of control > over direct (random access) I/O. I don't understand why everything has to be "done in one step." In Ada95, you have to declare an intermediate (abstract) type, in order to declare some attributes as public. It's really not that big a deal. If you follow that guideline that a type hierarchy should be declared in a package hierarchy, then there is no problem. This is exactly what you'd have to do in other OOP languages (because different classes are each declared in their own module). There seem to be two issues: 1) The relationship between types and modules. 2) The syntax of public versus private attributes. In issue #1, Ada95 gives you *more* than you get in other OOP languages, and that's the ability to declare different types in the same module. You can't do that in many other languages, so there's no limitation in Ada95. In issue #2, Ada95 does require you to declare an intermediate type. Yes, that's "extra" work, but how much are we really talking about? It's only one extra declaration, comprising a mere 2 SLOCS: package P.C is type NT_Public is abstract new T with record Public_Attribute : Public_Attribute_Type; end record; type NT is new NT_Public with private; ... end P.C; Why is everyone getting heartburn about having to declare type NT_Public? In C++, I'd have to use the keyword "public:" before listing the public members, so there's syntactic overhead in that language too.