Hacker News new | past | comments | ask | show | jobs | submit login

I'm no expert on compilers/interpreters, but wouldn't the added overhead of type checking cause things to slow down (genuine question)?



No, because it does the type checking already: it just fails to keep the type data into the runtime, which could be highly optimized if it had types. V8 apparently "generates" types on-the-go to make JS run fast, so if it had pre-built types it could already run the faster version of the code from the start.


Ah, understood. So, almost like Java compiling a class to bytecode before running in the JVM?


Yes, something like that. Interestingly enough, Dart has a mode to compile to the AST, so that when you run it, the interpreter does not need to parse the text again and check the types, it just starts straight off an AST. The TS compiler and V8 could definitely do something similar.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: