Article View: comp.lang.misc
Article #6420Re: Polymorphism
From: Nick Rothwell
Date: Mon, 24 Apr 1989 13:08
Date: Mon, 24 Apr 1989 13:08
56 lines
3046 bytes
3046 bytes
In article <5973@pdn.paradyne.com> alan@rnms1.paradyne.com (Alan Lovejoy) writes:
><ML is
><certainly polymorphic, although you can't "inspect" all values (they may
><be abstract, or function objects).
>
>By "inspect" I simply mean "read." If I can code "IF a = b," then I can
>"inspect" or "read" "a" and "b".
I stand by my words. You can't evaluate "a = b" in ML if a and b are functions,
since equality doesn't make sense. If they're abstract types, then any
default interpretation of "=" may be incorrect (e.g. sets represented as
lists).
><"modification" is only allowed on
><objects created specially for the purpose: how do you modify a function?
>
>By "modification" I simply mean "change." If I can code "INC(i)", so that
>the value of "i" is incremented to the next "higher" member of the ordered set
>of values of which "i" is a member, then I have the ability to "modify" "i".
I stand by my words here as well. If I bind X to 3 (in a functional language),
I don't want X to be alterable.
>Also, I really want to require that modification be possible in principle,
>if the programmer wants to define any operations that modify values of some
>type.
But the point of a high-level language is that it provides a firm semantic
framework for the objects that you're dealing with and the operations that
they support...? I don't think that making "any modification possible in
principle" is desirable. Or feasible, for that matter.
>As for "modifying a function," how about recompiling it? Or changing the
>input parameter "type" and/or "range" checking?
I distinguish "modification" and "re-binding". If I rebind a function "F",
that declares a new "F", which I can then go on and use. Existing code
doesn't see the change (unless it is also recompiled).
><"Storage in memory" - doesn't make sense for higher-order garbage collected
><languages.
>Would you accept Smalltalk as a higher-order garbage-collected language?
>What did you think I meant?
ML has objects which accept assignment, but no notion of "memory" or "address"
in the classical sense. The behaviour of ML reference objects is defined
semantically.
>Alan Lovejoy; alan@pdn; 813-530-2211; AT&T Paradyne: 8550 Ulmerton, Largo, FL.
Nick.
Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh.
nick@lfcs.ed.ac.uk <Atlantic Ocean>!mcvax!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
Fais que ton reve soit plus long que la nuit.
Technical Details
Message-ID:
<1834@etive.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!nickReferences:
<5957@pdn.paradyne.com< <1810@etive.ed.ac.uk> <5973@pdn.paradyne.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!nick From: nick@lfcs.ed.ac.uk (Nick Rothwell) Newsgroups: comp.lang.misc Subject: Re: Polymorphism Message-ID: <1834@etive.ed.ac.uk> Date: 24 Apr 89 13:08:56 GMT References: <5957@pdn.paradyne.com< <1810@etive.ed.ac.uk> <5973@pdn.paradyne.com> Sender: news@etive.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk (Nick Rothwell) Organization: LFCS Enya Admiration Society Lines: 56