Re:Killing the C++ Modules Technical Specification
by stepik777 on Wednesday October 11, 2017 @04:40PM
(#15453269)
> I still chuckle when randos make arguments like "C++ can't be parsed with an LALR parser"
I'm not an expert on parsers but I don't think LALR parser can evaluate constexpr C++ functions which is required for parsing C++.
E.g. in the following code, expression `A<f()>::a * u` will parse either as a variable declaration (int* u) or a multiplication (5 * 5) depending on the value returned by constexpr function f:
template<bool b> class A {};
template<> struct A<true> { typedef int a; };
template<> struct A<false> { static const int a = 5; };
constexpr bool f() { return true; }
const int u = 5;
int main() { A<f()>::a * u; }
Re:Killing the C++ Modules Technical Specification
by gpderetta on Wednesday October 11, 2017 @05:38PM
(#15453718)
I think that the OP point is that it doesn't matter much.
Re:Killing the C++ Modules Technical Specification
by steveklabnik on Wednesday October 11, 2017 @03:03PM
(#15452372)
Interesting, thanks. I asked in that thread because I legitimately wanted to know; I very much know that my C++ knowledge is ancient, and that many things are very different now. Always learning!
I still chuckle when randos make arguments like "C++ can't be parsed with an LALR parser", or "virtual functions are more expensive than function pointers", as if the former is the end of the world, and the latter is a checkmate that will suddenly make my knees week, arms heavy. There's code in my editor, and it's just spaghetti.