3 ms·
I wonder if Dlangs "betterC" would be a good fit, since you get real metaprogramming then.
by LAC-Tech 5y ago
I wonder if Dlangs "betterC" would be a good fit, since you get real metaprogramming then.
- elcritch 5y agoDlang's betterC would be a good option for just a better-than-C language but looks like it doesn't support D's standard library [1]. That'd mean being stuck with plain C container libraries. :/ Personally, I was impressed by an approach taken by the authors of Pixie (a fast 2d library like Cairo) [2]. They created a "library wrapper" generator for Nim code that supports creating libraries Python, Node, C, and Nim itself that they call Genny [3]. Haven't tried it but being able to use Nim and it's ref based gc but still export to nice API's in other languages is fantastic. Pixie's aim is to be a Cairo alternative so it makes sense they'd need this. I hope the approach takes off. Usually writing any cross language API's is a lossy operation. Here's a sample of the API definition: exportObject Matrix3: constructor: matrix3 procs: mul(Matrix3, Matrix3) 1: https://dlang.org/spec/betterc.html https://dlang.org/spec/betterc.html 2: https://github.com/treeform/pixie https://github.com/treeform/pixie 3: https://github.com/treeform/genny https://github.com/treeform/genny (edited formatting)
- david2ndaccount 5y agoThe consequences of betterC are listed out here. https://dlang.org/spec/betterc.html#consequences https://dlang.org/spec/betterc.html#consequences Notice that betterC does not exclude templates or destructors, so you could still use c++-style containers based around RAII, etc. The argument against it is a smaller ecosystem and you’d end up having to roll your own containers etc.
- ksec 5y ago>I wonder if Dlangs "betterC" would be a good fit, You mean "Das C" ? :)