Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!newsfeed.pitt.edu!gatech!howland.reston.ans.net!ix.netcom.com!netcom.com!rlo
From: rlo@netcom.com (Robert Orenstein)
Subject: Two Dylan Questions
Message-ID: <rloD1tKCG.7D6@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Date: Tue, 3 Jan 1995 07:48:16 GMT
Lines: 38

I've been playing with Dylan for about a week now, and so far, I'm very
impressed.  But I'm having a couple of problems...

***  I'm learning Dylan by writing an application that calls for three
types of vectors.  Each are vectors of particular objects; each vector type
will have its own methods.

I'm trying to create classes for each of the three arrays.  I can't
subclass <simple-object-vector> because it's sealed, and the DIRM specifies
that to subclass <vector>, I need to "provide or inherit an implementation
of SIZE that shadows the method provided by <array>".  How would I go
about doing this?

***  The second problem seems more serious to me.  I'm fairly new to
object-oriented programming (I've read a lot about it but have done very
little work with it), but I thought that one of the benefits of OOPs was
that many methods could have the same name, that the programmer is freed
from having to have, say, ten different names for "open" functions, like
"openFile", "openWindow", etc.  

Unless I'm missing something, it seems like I can do this with Dylan, but
only in a limited way.  I'm trying to write two "open" methods, each of
which acts on a different object, but my two methods each take a different
number of parameters, and the DIRM insists that "the generic function and all
methods for that function must have congruent parameter lists... the
two parameter lists must have the same number of required arguments".

Does this mean (and my experimentation leads me to belive that it does)
that there is no way to have two methods with the same name unless
they have the same number of parameters?  If so, why was this choice made?
Doesn't this require the programmer to know the names of all methods in
any library they're using in order to avoid conflicts in method names?
And doesn't this work against one of the main benefits of object oriented
programming?  If this is indeed a limitation, are there any workarounds?

Thanks,

Robert Orenstein
