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

compile time function evaluation is "nice" in the same way those features are, isn't it?


What's interesting is that other languages have since adopted CTFE, but they missed the point and did it wrong. The usual mistake is to add a keyword necessary to trigger it. D triggers it when an expression appears where a "const-expression" appears in the grammar. I.e:

    int x = f(); // f() is run at run time
    enum y = f(); // f() is run at compile time




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

Search: