Article View: comp.lang.misc
Article #3243Re: CHALLENGE: heterogeneous collections
From: Darren New
Date: Wed, 27 Mar 1991 20:48
Date: Wed, 27 Mar 1991 20:48
55 lines
3680 bytes
3680 bytes
In article <7689:Mar2623:28:5091@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>In article <48805@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes:
>> Hmm... How about a window with a hetrogeneous collection of buttons, sliders,
>> text displays, etc, all of which respond to "redraw" and "is the mouse
>> over you"?
>
>struct { any object; void (*redraw)(); int (*ismouseover)(); } *whatsinwindow();
>
>Here ``any'' is a polymorphic type (e.g., void * in C), and *redraw
>takes an ``any'' argument. Naturally, languages like C++ encapsulate the
>above struct into a single ``class,'' but that's merely syntactic sugar.
Am I crazy, or isn't (void *) impossible to indirect? Don't you have
to type-cast it first? Isn't this dynamic typing implemented on top of
C? I never said that C does not Bernstein-have dynamic typing. All I
said was that C doesn't have dynamic typing. (Actually, I probably
didn't say that either, but I do believe it.) "void *" is not a
polymorphic type; it is a pointer type. "object" is not dynamically
typed; it is of type "any" (i.e., void *). The fact that you can
typecast it does not make it a dynamic type, Dan. It merely means that
the designers of C realised that they needed some way of allowing you
to implement dynamic typing on top of C. But then, that's the
Bernstein-has form of the word "has." Please, in my future posts,
assume that I am using the English version of the word "has." Thank
you.
Dan, do you really think I'm so stupid that I don't know how to
implement dynamic typing on top of a statically typed language? Do you
really think that I, like you, willfully misinterpret what is being
said to support a different point of view without trying either to make
a point or learn something from somebody else? Do you really think I
would have given the above example as a hetrogenous list if it could be
represented in one line of code in a statically typed language?
Of course, C is completely useless because it's all merely syntactic
sugar for large finite state machines. That's how we can solve the
halting problem for it. Of course, since every language is merely
syntactic sugar for large finite state machines, discussing advantages
and disadvantages of different languages is moot -- just write a macro
expander.
Actually, all computers are analog computers. Binary is just syntactic
sugar on top of volatage differences. Since we can't have *real*
digital computers, but merely illusions of them, then we can't solve
the halting problem in the way you earlier proposed anyway.
For any discussion, a level of detail and abstraction can be chosen which
renders the discussion pointless. Thank you for finding that level
in this particular discussion, so we might avoid it in the future.
-- 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 unnecessary +
Technical Details
Message-ID:
<49087@nigel.ee.udel.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!ee.udel.eduReferences:
<pallas.669923769@red-dwarf> <48805@nigel.ee.udel.edu> <7689:Mar2623:28:5091@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!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: CHALLENGE: heterogeneous collections Message-ID: <49087@nigel.ee.udel.edu> Date: 27 Mar 91 20:48:26 GMT References: <pallas.669923769@red-dwarf> <48805@nigel.ee.udel.edu> <7689:Mar2623:28:5091@kramden.acf.nyu.edu> Sender: usenet@ee.udel.edu Organization: University of Delaware Lines: 55 Nntp-Posting-Host: snow-white.ee.udel.edu