This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
genericity vs inheritance
- To: guile@sourceware.cygnus.com
- Subject: genericity vs inheritance
- From: Chris Bitmead <chris@tech.com.au>
- Date: Fri, 23 Jul 1999 18:06:26 +1000
> > CLOS at least attempts to
> > address this issue, by letting you specialize a generic function on the
> > types of more than one of its arguments. But Java, C++, etc. just
> > totally punt the issue.
>
> I think this is the old "genericity vs. inheritance" problem.
> Bertrand Meyer showed that it is possible to emulate genericity on a
> system that supports inheritance but it is not possible to emulate
> inheritance on a system that only supports generic types/behaviour.
Are you sure we're talking the same thing here? "generic" in Eiffel
means like C++ templates - _One_ bit of code that can be expanded to
work on multiple classes. "generic" in CLOS is dispatching on type to
_multiple_ bits of code depending on type. Totally different issues.
As for "showing that it is not possible to emulate inheritance on a
system that only supports generic types", standard Scheme supports
neither generics nor inheritance, yet it is possible to support both
without extending the language.
> Scheme supports genericity
> genericity in the Eiffel sense is a non-issue in scheme because
> it is not statically typed. Only static typed languages care
> about this. and Java, C++ etc. support inheritance.
>
C++ supports generics in the Eiffel sense.
> Eiffel supports inheritance *and* (as a special
> case) a generic type so that it is not necessary to emulate it.
Not sure what you mean by Eiffel's special case.
Reporting-MTA: dns; fep8.mail.ozemail.net
Received-From-MTA: dns; h208.ozemail2.ozemail.com.au
Arrival-Date: Fri, 23 Jul 1999 09:57:47 +1000 (EST)
Final-Recipient: rfc822; guile@sourceware.cygnus.com
Action: failed
Status: 5.1.1
Remote-MTA: dns; sourceware.cygnus.com
Diagnostic-Code: smtp; 553 See http://www.orbs.org/blocked.cgi. Your mailserver is in the ORBS database. Consult with your mailserver administrator.
Last-Attempt-Date: Fri, 23 Jul 1999 09:58:06 +1000 (EST)
> > CLOS at least attempts to
> > address this issue, by letting you specialize a generic function on the
> > types of more than one of its arguments. But Java, C++, etc. just
> > totally punt the issue.
>
> I think this is the old "genericity vs. inheritance" problem.
> Bertrand Meyer showed that it is possible to emulate genericity on a
> system that supports inheritance but it is not possible to emulate
> inheritance on a system that only supports generic types/behaviour.
Are you sure we're talking the same thing here? "generic" in Eiffel
means like C++ templates - _One_ bit of code that can be expanded to
work on multiple classes. "generic" in CLOS is dispatching on type to
_multiple_ bits of code depending on type. Totally different issues.
As for "showing that it is not possible to emulate inheritance on a
system that only supports generic types", standard Scheme supports
neither generics nor inheritance, yet it is possible to support both
without extending the language.
> Scheme supports genericity
genericity in the Eiffel sense is a non-issue in scheme because it is
not statically typed. Only static typed languages care about this.
> and Java, C++ etc. support
> inheritance.
C++ supports generics in the Eiffel sense.
> Eiffel supports inheritance *and* (as a special
> case) a generic type so that it is not necessary to emulate it.
Not sure what you mean by Eiffel's special case.