comp.lang.ada
 help / color / mirror / Atom feed
From: dog.ee.lbl.gov!hellgate.utah.edu!cs.utexas.edu!asuvax!ennews!enuxha.eas.a su.edu!koehnema@ucbvax.Berkeley.EDU  (Harry Koehnemann)
Subject: Re: Ada vs. C++ Paper (was Re: Why ADA?)
Date: 20 Apr 92 16:27:24 GMT	[thread overview]
Message-ID: <1992Apr20.162724.7037@ennews.eas.asu.edu> (raw)

In article <1992Apr17.211751.24319@aero.org> jordan@aero.org (Larry M. Jordan) 
writes:
>I think you are describing invoking an overridden or redefined method.
>(Please correct me if I've misunderstood.)
>The redefined method must be qualified with the class name, or one gets
>the redefining method.  Has Eiffel changed? I thought renaming was 
>done in the INHERIT clause (by the inheriting class, not the defining class). 
  
	EIFFEL					C++

class A feature func		    |	class A { Public int func; };
    ....			    |
				    |
class B feature func, a_func	    |	class B : Public A {
    Inherit A			    |		Public int func; };
	a_func renames func	    |
    ....			    |
				    |
  Have access to X.func, X.a_func   |	Have access to X.func and X.A::func
			 ^^^^^^^^				  ^^^^^^^^^

Forgive the syntax.
The user of B should only know what features B offers, not how they are
being offered.  In C++, one is forced to include the class name A in any
reference to A's func through class B.  This means that if this relationship
between B and A changes, anyone using B will need to be modified as well.
This does not sit well with information hiding.  Multiple inheritance makes
these problems even worse - what happens when a class C inherits fomr A and
B, and then defines it's own func.  This type of renaming w/ multiple
inheritance led to internal compiler errors in the Eiffel compiler I used.

Really it seems as if people aren't worrying about defining the semantics
behind inheritance and simply patching their languages as problems crop
up.  IMO, that's what C++ did with the name visibility problem described
above and it's really a horrible solution.  Some might call this the
evolutionary approach to language design, but it looks more like patching
to me.  Eiffel appears to be an excellent example of design by patching.

>Does Ada "violate information hiding...", since a name can "propogate out 
>of a [package] with more than one meaning"?   

Ada has overloading, Eiffel doesn't.  Naming in Ada is not simply a name,
but also a profile or class of object (type, constant, ...).  Ada never
requires you to know how a package is implemented in order to use it.  If
a package B is offering a something that is actually implemented in some
package A, that relationship is transparent to the user of package B.
--
Harry Koehnemann
koehnema@enuxha.eas.asu.edu

             reply	other threads:[~1992-04-20 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-04-20 16:27 dog.ee.lbl.gov!hellgate.utah.edu!cs.utexas.edu!asuvax!ennews!enuxha.eas.a [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-04-29  0:27 Ada vs. C++ Paper (was Re: Why ADA?) Dan Olson
1992-04-24 14:47 Richard Bielak
1992-04-18 13:03 Bjarne Stroustrup
1992-04-18  9:35 eru.mt.luth.se!lunic!sunic!lth.se!newsuser
1992-04-17 23:52 Xmiester
1992-04-17 21:17 micro-heart-of-gold.mit.edu!news.bbn.com!usc!elroy.jpl.nasa.gov!aero.org!
1992-04-17 16:31 Larry M. Jordan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox