Re:Compile time evaluation in Nim, Zig, Rust and C++
by vaylian on Tuesday April 26, 2022 @04:53PM
(#31173040)
It's been a while since I last played around with Nim (back when it was still called Nimrod). But doesn't Nim compile to C and therefore it can interact with the entire C ecosystem? And afaik it is also camel-case-insensitive, so that you can call C functions without having to worry about different naming conventions?
[ Parent
| on HN ]
Re:Compile time evaluation in Nim, Zig, Rust and C++
by ryukoposting on Tuesday April 26, 2022 @06:20PM
(#31173882)
> But doesn't Nim compile to C and therefore it can interact with the entire C ecosystem?
You can directly call C code, yes. You can even work with macros! It's a lot nicer when you can import a package that provides an abstraction layer over the C code, though (for example, my `ruby' package)
> call C functions without having to worry about different naming conventions
Yes. In fact, if you hand-write your C bindings instead of using something like c2nim, you can completely change the name of the function. This is a snippet from my aforementioned `ruby' package:
proc evalString*(code: cstring): RawValue {.importc: "rb_eval_string".}