[email protected] wrote:
notice - this is statically typed. also notice the lack of explicitly encoded
typing - the compiler figures it out.
Yes type inference is wonderful, and for completeness let’s note that
in OCaml (and Haskel and Clean and…) we can also choose to add
explicit type declarations.
my point, in going down this tangent, is hopefully to point out what i always
point out in these threads - that people generally do not even understand what
it means to be statically (c is static ruby is not) or strongly typed (ruby is
strongly typed, c and java are not) and, furthermore, that having this
explicitly written by the programmer has nothing to do with the existence if a
feature in the language - taking ocaml’s type inference as an example.
Maybe part of it is easier to understand if we speak about
statically-type-checked and dynamically-type-checked.
What people mean by “strongly typed” is more puzzling to me. I’ll just
agree with this:
‘So what is “strong typing”? This appears to be a meaningless
phrase, and people often use it in a nonsensical fashion. To some it
seems to mean “The language has a type checker”. To others it means
“The language is sound” (that is, the type checker and run-time
system are related). To most, it seems to just mean, “A language like
Pascal, C or Java, related in a way I can’t quite make precise”. If
someone uses this phrase, be sure to ask them to define it for you.
(For amusement, watch them squirm.)’
p263 Type Soundness, “Programming Languages: Application and
Interpretation”
http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/
