3 ms·
Statically typed programs are longer because they contain more information.
by recursive 14y ago
Statically typed programs are longer because they contain more information.
- metaphorm 14y agothey don't contain more information. they contain more explicit declarations of that information. dynamically typed languages leave that information hidden because it is inferrable (or irrelevant).
- recursive 14y agoWhen the programmer is the one that has to be doing the inference you refer to, there seems to be a good argument that the speed advantage you refer to is only apparent in programs small enough to conceptualize in their entirety.
- kyllo 14y ago>dynamically typed languages leave that information hidden because it is inferrable (or irrelevant). So do good, high-level statically typed languages, i.e. the kind with type inference. Like Scala or ML.
- metaphorm 14y agoindeed. Scala's type inference system is truly beautiful. lets hope it catches on and becomes a widely adopted feature of the next generation of languages.
- tikhonj 14y agoIf you want to see a really beautiful type inference, take a look at Hindley-Milner. Not only is it global (it infers all the types in your program) but it's also surprisinlyg simple--it's basically just a straightforward constraint satisfaction problem. In particular, take a look at how it has been extended by real languages, especially OCaml. OCaml has some very cool sub-typing features but manages to maintain global inference, unlike Scala. (Largely by choosing structural rather than nominative sub-typing.) So some languages have had better type inference for longer than Scala has been around.