Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To be fair to Nim, only Python has the huge ML ecosystem of numpy, scipy, pandas, opencv, pytorch, tensorflow, keres... Doing ML/AI style work in anything but python is really hard!

That said Nim does have the nimpy library that allows for pretty seamless interop with python. Which means you can just import PyTorch, or scipy, or opencv and use them in Nim.



for me (mobile developer) interop with python is not enough because of really poor python story on mobile devices (iOS / android) when using native modules. I think if Nim had a seamless interop with Rust or even Zig it could piggyback on those communities to get some libraries for free.


For Rust at least one can use https://github.com/arnetheduck/nbindgen


That looks interesting. Unfortunately it looks like it hasn't been updated in a while? Is that because it's complete or a lack of interest?

For example, the approach mentioned at the bottom of the README of integrating via nlvm (https://github.com/arnetheduck/nlvm) sounded great but appears to be unpursued.


that looks interesting, thanks! Did you try it if it delivers on promises? There was not any new commit since 2020 so not sure if the project is stale by now.


I do not use Rust, so sadly I have not.


As a 2-step approach, you could also probably use https://github.com/mozilla/cbindgen and then Nim's native C FFI.


Dunno about rust, but since both Nim and Zig compile to C as interim, it should be fairly easy to get them working together, no?


Things might changed but last time I checked you could easily call C function but you had to kind of export each single C function, structs etc. You couldn't just import single header file and be ready to call any function in the library. There is some pending project [0] futhark but not sure how mature it is and that still only for C libraries (instead of C++ or Rust) but maybe easy adopt for Zig - would be great nonetheless.

[0] https://github.com/PMunch/futhark


Most of those libraries are written in C++ or C, which Nim has excellent support for. I've used opencv c++ library with Nim. It's just that opencv is so massive it'd take a lot of work to wrap well, so I haven't yet. Some folks are working on a pure Nim pandas lib too.


I found the following article about Nim and Rust interop:

https://dev.to/dumblepytech1/the-way-integrate-rust-into-nim...

Haven't read it yet but it looks promising.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: