Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust version is ridiculously unidiomatic #4

Open
emberian opened this issue Jan 4, 2014 · 3 comments
Open

Rust version is ridiculously unidiomatic #4

emberian opened this issue Jan 4, 2014 · 3 comments

Comments

@emberian
Copy link

emberian commented Jan 4, 2014

It looks like it's basically a straight line-by-line port of the C. A more idiomatic version would be using methods on structs. Would you accept a PR that updates this to be more sane?

@logicchains
Copy link
Owner

Sure, that'd be great. Maybe take a look a look at the C++ version, which wasn't written by me, as an example of a more structured approach.

Would it be possible to change it without updating the syntax? I used depreciated OpenGL version 2.1 functions, and the Rust OpenGL library only supports version 4 functions, so as I couldn't get the OpenGL bindings generator to compile on my build of Rust I manually wrote the bindings I needed instead. They're in lib.rs, in the repo. If the syntax of R.rs is updated to require a recent build of Rust to run, then I'll have to rewrite those bindings, as I believe the Rust FFI has changed in the last couple of months.

@emberian
Copy link
Author

emberian commented Jan 5, 2014

I had modified the GL binding generator so that it could generate bindings
for any version of GL. I'll wait a week or two and do it for 0.9. Thanks!

On Sat, Jan 4, 2014 at 8:19 PM, Jonathan Barnard
notifications@github.comwrote:

Sure, that'd be great. Maybe take a look a look at the C++ version, which
wasn't written by me, as an example of a more structured approach.

Would it be possible to change it without updating the syntax? I used
depreciated OpenGL version 2.1 functions, and the Rust OpenGL library only
supports version 4 functions, so as I couldn't get the OpenGL bindings
generator to compile on my build of Rust I manually wrote the bindings I
needed instead. They're in lib.rs, in the repo. If the syntax of R.rs is
updated to require a recent build of Rust to run, then I'll have to rewrite
those bindings, as I believe the Rust FFI has changed in the last couple of
months.


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-31593677
.

@logicchains
Copy link
Owner

Awesome, thanks! If possible, could you also have a go at replacing the emptyPt and emptyVt objects? For instance in:
static emptyPt : Pt = Pt{X:0.0,Y:0.0,Z:0.0,VX:0.0,VY:0.0,VZ:0.0,R:0.0,Life:0.0,is:false};
static mut Pts : [Pt, ..MaxPts] = [emptyPt, ..MaxPts];
I tried to have Pt implement the Zero trait and use that, but I couldn't get it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants