3 ms·
Statically typed usually means the compiler checks types during compilation and throws away information about them after generating the target code (usually, th
by anaphor 12y ago
Statically typed usually means the compiler checks types during compilation and throws away information about them after generating the target code (usually, there are exceptions like Java). So I doubt it will be able to tell you anything about types in the ouput (the web page) unless you do something with runtime contracts.
- girvo 12y agoHack doesn't get compiled, heh, it's interpreted so it's quite a bit different to what I'm used to. It's more like TypeScript in that regard, but TypeScript is still compiled... I've never used an interpreted typed language before, hence the question!
- anaphor 12y agoWell HHVM is a JIT compiler isn't it? Also it applies just as well to an intermediate representation (like bytecode, or some simpler language that gets evaluated).
- jwatzman 12y agoHHVM enforces the checks purely dynamically as it actually executes code. There's a totally separate tool that does the full static type analysis. See my sibling comment for details: https://news.ycombinator.com/item?id=7808586 https://news.ycombinator.com/item?id=7808586
- chriswarbo 12y ago> there are exceptions like Java Actually Java works in the same way; the confusion stems from imprecise use of jargon. Java tends to use the word "type" for things which would more precisely be called "tags". Tags are the run-time information which distinguish different values of the same type, and can't be erased in general. Java adds a bunch of rules about handling tags, for example object values have a "class" tag; class tags must be statically specified (AKA "type signatures"); class tags can be pattern-matched automatically (AKA dynamic dispatch, method overloading and inheritance), allowing functions to be defined in separate chunks (AKA methods); functions can only be applied to arguments which will match a pattern (AKA "type checking"), etc. These rules are checked at compile time as well as the types. Unfortunately all these different concepts tend to be grouped under the umbrella term "type checking", which makes fine-grained discussion and comparisons to other languages more difficult.