Article View: comp.lang.misc
Article #3451Re: Dynamic typing (part 31,497)
From: Nick Rothwell
Date: Thu, 11 Apr 1991 15:08
Date: Thu, 11 Apr 1991 15:08
54 lines
2944 bytes
2944 bytes
In article <1707@optima.cs.arizona.edu>, gudeman@cs.arizona.edu (David Gudeman) writes:
> This is a point I've made several times on several
> Haskell and ML programs, and I wish people would get the idea so I
> could stop repeating myself.
Sorry. I agree with your point, but your mention of maths confused me. You
said
> If f is a function and s is a sequence, then map(f,s) is the
> sequence t such that for all i . t[i] = f(s[i]).
Now, using such general terms as "function" and "sequence" in a mathematical
context, I assumed your were implying a homogeneous list. If you're assuming
heterogeneous sequences, then the kind of mathematics you're dealing with
gets more complicated than I assumed. I think.
If you're into the world of heterogeneous types, then you have to address
the situation where the function does something which makes no sense for
one of the elements (I agree that applying lambda x. (x :: nil) will work
for heterogeneous lists with more generality than ML or Haskell can
typecheck) - but then, as I say, the mathematics is getting complicated.
But, I dropped maths more than ten years ago...
> The statically typed program only works
> on structures in which all elements have the same type -- and only
> when the compiler can infer that type.
Er, the last sentence isn't true (if I were to nit-pick...). Given the
ML/Haskell definition of map, I can then write
- fun double list = map (lambda x. (x, x)) list
to turn a list into a list of pairs. The compiler still doesn't know the
type of the list (beyond a general polymorphic type) but it'll work anyway.
The list is, of course, homogeneous.
> Type inference has some nice features, but it does _not_ give you the
> expressive power of dynamic typing.
Fair enough. I choose the benefits of static typing (no runtime errors,
plus the ability to build specifications, interfaces and datatypes) and
find the expressive power denied to me to be no handicap. I have no
problem with other peoples' views, applications, whatever.
So. End of thread, right? :-)
Nick.
--
Nick Rothwell, Laboratory for Foundations of Computer Science, Edinburgh.
nick@lfcs.ed.ac.uk <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
"I see what you see: Nurse Bibs on a rubber horse."
Technical Details
Message-ID:
<8742@skye.cs.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nickReferences:
<1707@optima.cs.arizona.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!sdd.hp.com!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!edcastle!cs.ed.ac.uk!cs.edinburgh.ac.uk!nick From: nick@cs.edinburgh.ac.uk (Nick Rothwell) Newsgroups: comp.lang.misc Subject: Re: Dynamic typing (part 31,497) Message-ID: <8742@skye.cs.ed.ac.uk> Date: 11 Apr 91 15:08:06 GMT References: <1707@optima.cs.arizona.edu> Sender: nnews@cs.ed.ac.uk Reply-To: nick@lfcs.ed.ac.uk Organization: Tasha Yar Appreciation Soc... oh, sh*t Lines: 54