3 ms·
Oh I see, so there's no change in code generation for typed code, then?
by maxiepoo 13y ago
Oh I see, so there's no change in code generation for typed code, then?
- jwatzman 13y agoAt runtime, we check and enforce parameter types at function entry and return types at function exit. The extra type information can also enable the JIT to emit more efficient code in some cases, and work is ongoing to make that even more efficient. But having these types is independent of being in Hack -- you can have fully untyped Hack code, though I wouldn't advise it, as you are leaving one of the most powerful features of the language on the table.
- maxiepoo 13y agoWhat do you do with higher-order functions (which PHP has I believe)? If I write a typed map : (a -> b) -> [a] -> [b] and then it's called with an untyped function as input, but it returns a something that's not a b. Do you place some kind of barrier around it so that that's stopped immediately?