5 ms·
I mean that's the point of tooling. Metaprogramming removes any advantage and IDE can give you to make sense of unknown code.
by throwaway91111 9y ago
I mean that's the point of tooling. Metaprogramming removes any advantage and IDE can give you to make sense of unknown code.
- KirinDave 9y agoThis is strictly false though. IDE integration can give insight into metaprogramming in many languages.
- falcolas 9y agoPython, the language in question, does not easily offer this support, since all of the metaprogramming occurs at runtime. You have to run a debugger while creating the object to see what is actually happening. Lisps, C Preprocessor (within certain limits), and so forth are a bit different, since you can expand the macros without having to run the code itself. Does that indicate a strength of Python or a weakness? A complete value judgement there. In either case, metaprogramming in Python (and many other languages, even those with support for metaprogramming resolution in their IDEs) is still simply harder to understand and debug.
- KirinDave 9y agoI feel no real problem shaming the entire design of Python as a long bet on failed premises. But other languages with similar properties can and do report their metaprogramming results to language servers.
- throwaway91111 9y agoAgreed completely—this is the difference between metaprogramming and "black magic", which is familiar to any ruby programmer.
- aoeusnth1 9y agoYes, that explains why the language is failing.
- kazinator 9y agoEven that IDE known as Vim + Ctags will jump to a "defmacro" definition if your cursor is on a macro call and you type Ctrl-] to chase a tag.
- throwaway91111 9y agoThis only works for metamagic identifiable macros. What if you refer to an identifier that doesn't exist anywhere in the code? What about ruby's method_missing? It's impossible to provide tooling for those cases without running the compilation or evaluating.