Xref: utzoo comp.lang.c++:11550 comp.lang.eiffel:1397 comp.object:2540 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!uunet!pdn!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++,comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Message-ID: <27B2AC23.4B82@tct.uucp> Date: 8 Feb 91 13:48:19 GMT References: <1080@tetrauk.UUCP> <27A9AB0C.4794@tct.uucp> <1086@tetrauk.UUCP> Followup-To: comp.lang.c++,comp.object Organization: Teltronics/TCT, Sarasota, FL Lines: 41 According to rick@tetrauk.UUCP (Rick Jones): >In article <27A9AB0C.4794@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >>Inheritance and information hiding issues are orthagonal to assertion >>issues. A given language may support the former, the latter, both, or >>neither. Let's keep the discussions clear. > >The connection between assertion and information hiding >had already been made. Okay, I'll grant that point. My reaction was perhaps stronger than necessary because I don't want this discussion to degenerate into "my language can beat up your language." I'm sorry if I overdid it. >My point is that, as far as maintaining invariants is concerned, there is more >than one way to skin a cat. In fact my view is that assertions are a superior >method. I can see a place for both. There are times when strict invariant checking would have caught problems in my code. The GNU C++ compiler includes a "wrapper" mechanism, which replaces calls to functions with specific return and parameter types with calls to a wrapper function, one parameter of which is the address of the "real" function. This mechanism is too limited for general assertion checking, however, because of the requirement that each set of return and parameter types have its own wrapper. I read about a proposed extension to C++ called A++, or Annotated C++, by Marshall Cline of Clarkson University and Doug Lea of SUNY. It defines assertions for the class ("legal:") and for member functions ("axioms:" with "require" and "promise" assertions). The resemblance of A++'s assertions to those of Eiffel is acknowledged in the introduction to the paper, ``Using Annotated C++.'' (Similar problems lead to similar solutions.) They hoped to avoid redundant checks when member functions call each other, and described obvious code generation tricks to that end. I wonder if they ever got their proof-of-concept compiler working...