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

> D does not require names in global scope to be declared lexically before they are used. C++ only does this for class/struct scopes.

But how do you handle a template substitution failure? In C++:

    template<typename T>
    auto bar(T x, T y)
    { return x + y;}
The compiler has no idea whether bar(1, 2); will compile unless it parses the full definition. I don't understand how the compiler can avoid parsing the full definition.

The expensive bit in my experience isn't parsing the declaration, it's parsing the definition. Typically redundantly over thousands of source files for identical types.



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

Search: