Python and generic programming

Oliver Fromme olli at haluter.fromme.com
Mon Oct 25 07:11:45 EDT 2004


Steven Bethard <steven.bethard at gmail.com> wrote:
 > Could you explain a little more what about OCaml makes you consider it 
 > dynamically typed?

Well, it probably depends on what exactly you mean by
"dynamically typed".

For example, a function can take an argument that is
either an integer or a string (or a list or whatever)
and it does _not_ have to be known at compile time
which of those is the case.  But the compiler _does_
ensure that the function will work correctly for every
case (by checking that the pattern matching covers
every case, and within each case, the respective type
of the argument _is_ known and is checked at compile
time).

I call that dynamic.

For me, static typic is when every variable has a fixed
type at compile time (which is particularly true when
variables' types have to be declared).

Best regards
   Oliver

-- 
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)



More information about the Python-list mailing list