🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3342

Re: The search for heterogeneous lists is still on!

#3342
From: Darren New
Date: Tue, 02 Apr 1991 22:24
60 lines
3633 bytes
In article <167:Mar3121:32:0891@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>So far, people have given lots of examples of lists of union types.

>Does anyone have an example of a heterogeneous list---something beyond
>unions and callback functions---used in a real program?

I think the type system is the way you look at things, not the way you
implement them.  Dynamic typing is usually going to be implemented with
unions and callback functions. To say that printf does not have a
hetrogeneous list of arguments but rather a list of unions kind of begs
the question.  printf's implementation has all the drawbacks of dynamic
typing that people have pointed out: extra runtime overhead,
misinterpretation of bits when the expected type doesn't match the
stated type, and so on.  I see unions as hetrogeneous types
themselves.  I can see only three uses for unions:

1) saving space (by only using one element at a time), which isn't
   needed if you have real dynamic typing.
2) type punning, which isn't needed unless you are hacking bits, and isn't
   excluded by dynamic type systems,
3) making hetrogeneous arrays, like symbol tables or printf arguments.

I think part of the problem here is that Dan Bernstein is saying "there
is no such thing as a hetrogeneous collection" without giving a clear
definition of a hetrogeneous type. If you have a definition in mind,
why don't you post it, Dan?  If you don't, why don't you accept one of
the two or three that have come across the net already.  I naturally
like mine, but choose any you want and I'll try to find an example.  If
you are going to say "there is no definition of hetrogeneous collection
which I will accept" then I can't see how you can contribute anything
meaningful to the discussion; maybe you can clarify it.  As always,
it's all in your mind, and if you insist on talking about implementation
of dynamic types or hetro lists only, while refusing to look at it from
the next level of abstraction up, I don't see anywhere that communication
between you and others can progress.

>I suspect not. After all, if a module is like printf and understands
>all the possible types of objects in the list, it's dealing with a union
>type. 

And exactly how is an array of unions different from a hetrogeneous array?

>If a module does not know all the possible types, it's going to
>see just a set of function pointers, and it won't even *want* to deal
>with the object except through those function pointers. 

Again, how is this different from a hetrogeneous array?  Nobody said that
hetro arrays could not be implemented with unions and callbacks.  I just
don't know what that has to do with whether they are hetro arrays or not.

>If there is a
>middle case, how would you use it?

Can you define "middle case"?
--Darren
-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, FDTs -----
  +=+=+ My time is very valuable, but unfortunately only to me +=+=+
+ When you drive screws with a hammer, screwdrivers are unrecognisable +
Technical Details
Message-ID: <49591@nigel.ee.udel.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!ee.udel.edu
References: <167:Mar3121:32:0891@kramden.acf.nyu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!ee.udel.edu
From: new@ee.udel.edu (Darren New)
Newsgroups: comp.lang.misc
Subject: Re: The search for heterogeneous lists is still on!
Message-ID: <49591@nigel.ee.udel.edu>
Date: 2 Apr 91 22:24:15 GMT
References: <167:Mar3121:32:0891@kramden.acf.nyu.edu>
Sender: usenet@ee.udel.edu
Organization: University of Delaware
Lines: 60
Nntp-Posting-Host: estelle.ee.udel.edu