4 ms·
As an experiment, I've tried replacing C with Terra for a few projects. It feels like C++, except without the constant guilt. Having a proper hygienic macro sys
by an_ko 11y ago
As an experiment, I've tried replacing C with Terra for a few projects. It feels like C++, except without the constant guilt. Having a proper hygienic macro system (instead of C's very limited string-replacement "macros" or C++ template hell) is a really helpful abstraction, and the compile-time stuff you can do can basically act as a build system.
So I got excited and planned to use it to make a game, but although it can import existing C libraries [1], it can't import global variables, constants, or macros that take arguments, which puts a whole lot of existing libraries just out of reach.
This doesn't seem to have stopped Leonard Ritter from using it for Nowhere anyway, though being a crazy genius, he seems to have written his whole environment from scratch. [2] [3]
[1]: http://terralang.org/api.html#c-backwards-compatibility http://terralang.org/api.html#c-backwards-compatibility
[2]: http://blog.duangle.com/2015/01/conspire-programming-environment-for.html http://blog.duangle.com/2015/01/conspire-programming-environ...
[3]: https://bitbucket.org/duangle/nonelang/src https://bitbucket.org/duangle/nonelang/src
- nickpsecurity 11y ago"Having a proper hygienic macro system (instead of C's very limited string-replacement "macros" or C++ template hell) is a really helpful abstraction, and the compile-time stuff you can do can basically act as a build system." Exactly. I long ago came to the conclusion that any modern systems language should have a hygienic, macro system to balance productivity/maintenance against performance. Just makes things so much easier. That morons can abuse it is no reason not to have it in the language as they abuse everything haha.
- shahbazac 11y agoHow is terra's performance? You sort of compared it to C++, can it actually be compared with C++ in terms of latency performance?
- an_ko 11y agoVery good. I didn't benchmark it myself, but the language is designed for high-performance computing, and the authors' PLDI paper [1] shows it is competitive. Given that at the lowest levels, Terra basically reimplements C, and both compile to LLVM IR, similar performance is unsurprising to me. The main point that gives Terra an edge is that its macro system makes implementing and testing potential optimisations easier. [1]: http://terralang.org/pldi071-devito.pdf http://terralang.org/pldi071-devito.pdf § 6. Evaluation