4 ms·
Also tools become much easier. There are few good refactoring tools for C++ because the language is almost impossible to parse. In fact, even generating tags
by martincmartin 11y ago
Also tools become much easier. There are few good refactoring tools for C++ because the language is almost impossible to parse. In fact, even generating tags for vim/emacs is nearly impossible.
- pldrnt 11y agoMy thoughts exactly, as someone who has spent quite some time creating a (usable and readable) LALR syntax that can do everything modern C++ does (plus named arguments, a null-coalescing operator and extension methods) and is currently writing a transpiler based on it, I hope more people share your concern :)
- nickpsecurity 11y agoAnyone who used Modula-3... https://en.wikipedia.org/wiki/Modula-3 https://en.wikipedia.org/wiki/Modula-3 ...knows that one can have key features of C++ for systems programming with an easy-to-parse, safer, and [for a time] more efficient language. The SPIN OS team even modified it with type-safe linking so one could hotload code into the OS. What I saw there was "hotload code into running system" w/ associated benefits during updates. Or safer, better JIT. ;) Anyway, combined with LISP-style macros & irritating parts removed (eg uppercase, verbosity), you get a system language that blows C++ away in productivity (esp w/ DSL's), compiler efficiency, maintenance, and possibly run-time efficiency. The world might have went in a different direction but they better be honest about parsing pain they created. And all the productivity opportunities lost due to that.
- msie 11y agoTakes me back to the past when Metrowerks created a Modula-2 compiler for the Mac: https://en.wikipedia.org/wiki/Metrowerks https://en.wikipedia.org/wiki/Metrowerks
- nickpsecurity 11y agoDidn't know they started out with Wirth's compiler. Picked the best one. Then market rejected it. Then pivoted to a more successful approach supporting whatever crud was popular. The recurring pattern. Also didn't know they supported that many platforms. Impressive.
- lultimouomo 11y agoWhile syntax surely doesn't help, I think the real blocker is actually the preprocessor.
- umanwizard 11y agoC has basically the same preprocessor, and ctags works mostly fine.
- pjmlp 11y agoctags is a pretty bare bones compared with what an IDE with semantic analysis is capable of.
- qwertyuiop924 11y agoNo, the real problem is the both C and C++ are context sensitive. (In C compilers, though not C++ ones, 'the lexer hack' is the most common solution) That's fairly hard to parse, although not as bad as some languages. For preprocessing, it's fairly easy to write a C preprocessor, and then look at how your code will look if various options are defined... Actually that would be a really good debugging tool. I should go write that. And then make an emacs mode for it, so that you can type one command at any point, and see how your function/file/whatever will be transformed by the preprocessor.