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:
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: