[Prev][Next][Index][Thread]
Multiple dispatch / multimethods??
-
To: info-dylan@ai.mit.edu
-
Subject: Multiple dispatch / multimethods??
-
From: "Gary Stephenson" <garys@ihug.com.au>
-
Date: Sat, 21 Jul 2001 07:30:02 -0400 (EDT)
-
Organization: The Internet Group (Sydney)
-
Xref: traf.lcs.mit.edu comp.lang.dylan:13487
Hi all,
I've been lurking this forum for quite a while now, hoping that I might pick
up some wisdom through some sort of osmotic effect - alas .... <g>
Hopefully I will one day find the time and energy to actually learn Dylan
properly - the more I find out about it the more I like it. Except that it
doesn't appear to be headed for the "mainstream" anytime soon :-( OTOH Java
appears very much to be in the "mainstream", and for this reason I am
currently endeavouring to overcome my distaste for statically typed
languages in the interests of feeding the family!
I am intrigued by the notion of multimethods, and would appreciate some
feedback on the following notion:
Assume one was to adopt a convention in one's Java programs to have two
distinct class hierarchies. The first type of class - ( call it a
"DylanClass" ) would, by convention, only ever contain instance variables,
plus appropriate setter/getter methods. The second class would be an
abstract class (call it a "GenericFunctionClass" ) serving as a sort of
prototypical generic function. Each actual "generic function" would then be
a descendant of the "GenericFunctionClass", containing nothing but a bunch
of overloaded constructor methods.
How close would these GenericFuntion instance then be to Generic Functions a
la Dylan? What would be the salient differences? Could/would such an
approach be of any benefit to one's Java programs?
Many tias,
gary
Follow-Ups: