News for hackers. Stuff that matters.
Re:The Neat Programming Language by zem on Monday December 25, 2023 @02:15PM (#38765230)
I perked up at "like D but with built in sum types". is C interop intended to be as good as D's?
Re:The Neat Programming Language by FeepingCreature on Monday December 25, 2023 @02:18PM (#38765262)
It runs on plain C ABI, so you can just define C functions as `extern(C)`, just as you would in D. But you can also use `std.macro.cimport` to import C headers directly. Check out the Dragon demo, https://github.com/Neat-Lang/neat/blob/master/demos/dragon.n... :

    macro import std.macro.cimport;

    import c_header("raylib.h");
And then you can just use (most of) the Raylib functions and types.

cimport is a massive hack: it runs gcc on the header in preprocessor expansion mode, then parses the result. Its tactic for C syntax it doesn't understand is "just skip it and hope for the best." :) Works surprisingly well.

On x86, there was a lot to be gained from having a language specific ABI, because the cdecl ABI was so slow. But the x86-64 ABI, much as I may dislike its complexity, is genuinely plenty fast already.