You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Making C++17 required for the ANTLR C++ runtime would allow usage of std::string_view, std::any, and many other additions. Using std::any would allow for potentially removing antlrcpp::Any and std::string_view would enable removing needless copying of strings at various locations of the runtime including the generated parsers/lexers.
I took a stab at getting rid of antlrcpp::Any, but I quickly found out that it is not compatible with std::any. std::any only supports casting to the same type that it was constructed with. antlrcpp::Any allows dynamic_cast. The only way out is to ultimately break source compatibility. IMO we should deprecate all the non-std::any compatible features, wait a bit, then remove it. Up to you though, not sure what ANTLR's policy is on that.
The thing is: there's only a single release per year, usually. Waiting would mean to delay the change by at least a year. Instead, we should just go ahead and switch. The older versions are still available for some time, if someone needs the old functionality.
That certainly makes things easier. I will then just switch antlrcpp::Any to std::any after #3335. Then proceed to replace std::string with std::string_view where applicable, especially in generated code to avoid making copies of strings literals that already have static storage duration.
Activity
mike-lischke commentedon Oct 31, 2021
I actually expect a PR for switching to std::any, but I lost track of who wanted to do that and post a PR. But I'm all for that switch.
jcking commentedon Nov 1, 2021
I took a stab at getting rid of
antlrcpp::Any, but I quickly found out that it is not compatible withstd::any.std::anyonly supports casting to the same type that it was constructed with.antlrcpp::Anyallows dynamic_cast. The only way out is to ultimately break source compatibility. IMO we should deprecate all the non-std::any compatible features, wait a bit, then remove it. Up to you though, not sure what ANTLR's policy is on that.mike-lischke commentedon Nov 3, 2021
The thing is: there's only a single release per year, usually. Waiting would mean to delay the change by at least a year. Instead, we should just go ahead and switch. The older versions are still available for some time, if someone needs the old functionality.
jcking commentedon Nov 4, 2021
That certainly makes things easier. I will then just switch antlrcpp::Any to std::any after #3335. Then proceed to replace std::string with std::string_view where applicable, especially in generated code to avoid making copies of strings literals that already have static storage duration.
jcking commentedon Dec 13, 2021
Fixed now.