Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks, that first post is really interesting. Two things stand out to me:

* Run regular code at run time - does this just error if you try to use const on something that depends on a runtime value?

* Add your own optimizations to the compiler - isn't this very dangerous, especially if optimizations from various sources of code get combined? Even if your optimizations are valid (which there seems to be no guarantee of), computer math is notorious for being different from real math. People unaware of the nuances of integers rolling over or floating point seem like they could easily shoot themselves in the foot here.



> * Run regular code at run time - does this just error if you try to use const on something that depends on a runtime value?

Yep. For example `const foo = stdin.readLine()` would result in "Error: cannot evaluate at compile time: stdin".

As for your second point. I haven't used this feature personally but I have heard that the compiler will tell you exactly where these optimisations are applied. You can also disable these optimisations very easily during compilation.




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

Search: