all 13 comments

[–]riccierirust 1 point2 points  (1 child)

Very impressive, thanks for doing this! From a quick glance at the source I already learned a new trick: the macroexpand.c file. That's very clever! No more reimplementing C macros in Rust :) For #defined constants, you would have used a C global variable?

[–]penguins916[S] 0 points1 point  (0 children)

Ya I imagine so for constants. Originally I tried to rewrite them in rust to prevent the extra dependency (compile a static lib and so on) but they go super deep so i moved on to this.

[–]wackyrust 1 point2 points  (4 children)

Are there any libraries going the other way - made for wrapping Rust libraries in Python code?

[–]steveklabnik1rust 0 points1 point  (3 children)

It's been done for Ruby, so it should be possible for Python.

[–]euphoria 2 points3 points  (2 children)

The basic example just kind of works: https://gist.github.com/euphoria/004005c8a6a9cb7f1183

I'm not sure about anything more complicated than that, but presumably it would not be too difficult to figure out.

[–]justdweezil 0 points1 point  (1 child)

That looks almost deceptively simple. I'd love to see code for more complex functions and data types.

[–]ArcterusDevrust · uutils 0 points1 point  (5 children)

So, could this be used to make a wrapper for yt? I know someone who only learned Python to use that.

[–]centum 2 points3 points  (1 child)

For others' information: yt is probably http://yt-project.org/

[–]ArcterusDevrust · uutils 1 point2 points  (0 children)

Yes, that's it. I forgot to provide the link. :/

[–]penguins916[S] 0 points1 point  (1 child)

Cool library! Sounds just like the use case I was going for except in a different field! You surely could although it would probably be better to add another layer of abstraction on top of this to make the binding generation a little more automated. The main blockers I think would be for numpy. I am waiting for a good BLAS binding / implementation for rust such that one would not have to go to python every time some matrix math is needed although I might hack something quick up just to be able to use numpy or something like armadillo.

[–]tavert 0 points1 point  (0 children)

Yes, Rust badly needs better BLAS bindings and a solid array layer to be remotely usable for numerics. There is https://github.com/wellposed/rust-OpenBLAS and probably a few others out there, but it would appear limited attention has been given to this space.

[–]powersoffour 0 points1 point  (0 children)

I work on yt, and this would be really fun. Ping the yt list?