[comp.arch] Polymorphism

nick@lfcs.ed.ac.uk (Nick Rothwell) (03/19/90)

In article <6143@crdgw1.crd.ge.com>, chao@sunflower (William Chao) writes:
>In the paper "Basic Polymorphic typechecking," by Luca Cardelli,
>Science of Computer Programming 8 (1987) pp. 147-172. On page 150:
>-----------------------------------------------------------------------
>Polymorphism in language comes from the interaction of two contrasting
>programming language design goals: static typing and reusability.
>             :
>             :
>Polymorphic type systems try to reconcile these two goals
>by providing all the safety of statically typed languages,
>and most (but not all) the flexibility of untyped languages.
>-----------------------------------------------------------------------
>My 1st question: Why he says "but not all?"

You can't, for example, create a list of a mixture of objects of
different types, like you can in untyped languages.
(Well, there are more uptodate features that allow this kind of
thing, like open-ended variant types, but Cardelli's paper
is quite old.)

>2nd question: It seems that the "full" flexibility of untyped languages
>              will never be achieved by static typing, then static binding.
>	      Does this imply that we got to have dynamic binding to accomplish
>	      the full reusability?

I'd rather have static typechecking than "full reusability", whatever
that might mean.

>3rd question: People (especially real-time systems) are against dynamic binding
>	      because it is too slow. Some people use the same reason (too
>	      slow) to against object-oriented programming. Can we do somethings
>	      about this?

I don't personally care for dynamic binding or dynamic typechecking.
Regarding OO: I feel that a fair amount of static analysis in a
compiler could cut out a lot of the (currently) dynamic work; but,
I feel that OO languages are currently too ill-defined semantically
to approach this problem in a formal manner.

>I will appreciate whoever in this news group gives me the answer.

You're welcome.

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
      A prop?   ...or wings?      A prop?   ...or wings?      A prop?