原文链接:http://www.reddit.com/r/programming/comments/63tnv/bruce_eckel_33104_im_over_it_java/c02qx55
Latent typing is any type system where you do not need to explicitly write the types of variables down in source code. Its opposite is manifest typing, where you do need to explicitly write the types down in source code.
Static typing is a type system where individual expressions in the source code must have types, whether written or inferred by the compiler. Dynamic typing is a type system where run-time values have types (or not, as the case may be), yet program expressions can be any type. (Purists often say that dynamic typing isn't a type system at all, since the academic definition of types are a syntactic property of the code, but that's getting overly pedantic IMNSHO.)
The overlap is in type-inferencing systems. Languages like Haskell and Ocaml are statically-but-latently typed, with the compiler figuring out the types of your variables.
In theory, there's also an overlap on the other side, where types are written in the source code but aren't checked until runtime. Python 3000 has proposed a system like this, and Common Lisp and Dylan do something similar.
Bruce Eckel's actually using "latent typing" wrong in this article; he really means "structural subtyping". Basically, structural subtyping means that objects or expressions are tested for type-compatibility based on their structures (the methods/fields/values they support), while "nominal subtyping" means that objects are tested for compatibility based on explicit subtyping declaration by the programmer (think Java interfaces). Haskell, ML, and most dynamically typed languages are structurally-subtyped, while most industrial languages are nominally-subtyped.
There's also strong vs. weak typing, which has to do with whether the runtime automatically coerces values to different types.
So basically, there are 4 dimensions:
And you can place most languages on one of these 4 axes, though several support multiple forms of typing:
newtype
and manifest typing through optional type declarations. isinstance
or Ruby equivalent, but good practice frowns upon it.