4 ms·
I wrote an extremely hard and complex program in which I had to use c++ metaprogramming throughout. Not my decision. I do not understand why you could possibly
by cleandreams 4y ago
I wrote an extremely hard and complex program in which I had to use c++ metaprogramming throughout. Not my decision. I do not understand why you could possibly need more metaprogramming than C++ provides. This is a problematic feature to begin with. Not worthless but not worth much. The debugging was difficult. Many problems show up buried in literally thousands of compiler error messages.
- P5fRxh5kUvp2th 4y agoC++ started with templates as a type polymorphism mechanisms. Then it was shown to be turing complete so people started using it as such. The over time it started getting more and more things constexpr such that it's easier to execute during compile time (because it's turing complete). Jai just made the decision that everything is constexpr by default. And the answer to your question is that it's easier to do in Jai (in theory) than C++.
- gallier2 4y agoThat's the issue with C++ metaprogramming. It's so unwieldy and complex that the benefits are difficult to see and the occasions to be worthwhile limited. When the language has better (i.e. simpler) facilities for meta-programming like D, it will open big venues where it makes sense to use it. It is like programming object oriented in C, it is possible to do but so unwieldy and requiring discipline and verbose boiler plate that there's rarely an occasion where it would be interesting to use. While it is much easier to do in C++ or D or Java (etc.) as they provide the abstractions that makes it useable. C++'s meta-programming facilities are not good enough.
- bjourne 4y agoI disagree. Object-oriented programming is very easy in C even though the syntax itself doesn't guide you. Essentially, all C code I write is object-oriented. Perhaps you are thinking about dynamic dispatch which indeed is very annoying to implement correctly in C?
- deleted 4y ago[deleted]
- shakow 4y agoThe problem with C++ metaprogramming is not what you can do with it, it's how you do it; which, IME, is always the most convoluted, unsafe way possible. The “siamese brothers”-ization of templating & metaprogramming is especially painful.