Article View: comp.lang.misc
Article #3245Re: CHALLENGE: heterogeneous collections
From: adam
Date: Thu, 28 Mar 1991 16:36
Date: Thu, 28 Mar 1991 16:36
41 lines
2436 bytes
2436 bytes
In article <24673:Mar2802:15:1091@kramden.acf.nyu.edu>,
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
|> In article <1991Mar27.164605.24547@visix.com> adam@visix.com writes:
|> > Let me get this straight. To construct a heterogeneous list of M
|> > items each guaranteeing N operations, I need to waste space for M*N
|> > function pointers?
|>
|> No, because you can just have a single ``class'' structure with the N
|> function pointers, and keep just one pointer per ``object.'' But this
|> extra layer is pointless for small problems, and I didn't bother putting
|> it in.
Okay, all objects of the same class can share a function table.
But I would still have to make each "list of {fooable, barable}"
and "list of {fooable, bazable}" use a new and different class,
each with their own function table and constructor. And so a
{fooable, barable, bazable} object is still classified twice,
which is a waste.
People want to use dynamic typing when they expect large numbers of
different lists with different (and arbitrary) commonalities.
|> > And I need to write an explicit constructor for every kind of list?
|>
|> That depends on what you mean by ``explicit.'' If you have several types
|> each supporting some sort of redraw operation, and you want to set up a
|> list of redrawable things, then you do have to say the correspondence
|> between ``redrawable'' and the redrawing for each type. Other posters
|> have mentioned how in object-oriented languages you can make the
|> redrawing class either a superclass or a subclass of all the classes in
|> question; either way provides the necessary correspondence, but I
|> wouldn't say it's explicit.
|>
|> ---Dan
As I see it, your form of dynamic typing requires a class heirarchy,
with multiple inheritance yet.
I think, for instance, the dynamic typing in GNU Emacs is better.
Adam
Technical Details
Message-ID:
<1991Mar28.163600.3879@visix.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!visix!ip2020!adamkshReferences:
<48805@nigel.ee.udel.edu> <7689:Mar2623:28:5091@kramden.acf.nyu.edu> <1991Mar27.164605.24547@visix.com> <24673:Mar2802:15:1091@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!visix!ip2020!adamksh From: adam@visix.com Newsgroups: comp.lang.misc Subject: Re: CHALLENGE: heterogeneous collections Message-ID: <1991Mar28.163600.3879@visix.com> Date: 28 Mar 91 16:36:00 GMT References: <48805@nigel.ee.udel.edu> <7689:Mar2623:28:5091@kramden.acf.nyu.edu> <1991Mar27.164605.24547@visix.com> <24673:Mar2802:15:1091@kramden.acf.nyu.edu> Sender: news@visix.com Reply-To: adam@visix.com Organization: Visix Software Inc., Reston, VA Lines: 41