3 ms·
Yeah I really like Terra. One thing I've been wondering is if it can be done with C or C++. In other words, could you replace the C preprocessor / C++ metapro
by chubot 10y ago
Yeah I really like Terra. One thing I've been wondering is if it can be done with C or C++.
In other words, could you replace the C preprocessor / C++ metaprogramming with something like Lua? That is, have Lua/C instead of Lua/Terra.
That would be adopted a lot faster than a brand new language. I think one problem as always is parsing C++, but that should be doable with Clang now.
EDIT: Also, what about it is not ready for prime time?
- jacobush 10y agoNot convinced... the C preprocessor is tolerated because it is so small. Lua + C would really confuse at least me. But nothing's really stopping you I guess. Lua, or any script-ish language could be used instead of the C preprocessor. Why not Python? Perl?
- ndh2 10y agoYou already answered the question: Because it's small.
- jacobush 10y agoYes I agree
- makapuf 10y agosomething I never understood is why not compile-time C semantics and proprocessor and actually enforce some compiler optimizations ? This is basically the direction of constexpr in fact with C++. I would love a new, slightly fixed/incompatible C17 (not D or subpart of C++, just C11) with - c++17-like constexpr (and its uses anywhere : switch cases, array sizes.. ) - deprecated oldstyle args, undeclared functions, trigraphs - (templates can be mostly done with pure inlining+constexpr) - better keywords (static -> private (by default/explicit public), persist ) - fixed operators precedence (1<<3 +1=16 yay) - typed enums with explicit storage class - reduce preprocessor ability(discourage and just generate from lua/python/C programs if you really need, maybe with a shebang-like line). replace conditional compilation with constexpr ifs,
- shakna 10y agoM4 comes with most Linux distributions. Similar to the cpp, but recurzive with a couple extra features. It's just a little painful to use.