Live data from Hacker News

Announcing Rust 1.0 Alpha

blog.rust-lang.org

81–90 of 255 posts

Re: Announcing Rust 1.0 Alpha

#81
Being a game developer, inheritance is a really important language feature. I'm not one to abuse the power. Currently, for school I've been working on an OpenGL game engine in C++. It's a component based system. The only real inheritance situation that's important to me, is to allow the user of the engine to create any object and make it inherit from GameObject (example: Duck would inherit the members and methods from the GameObject class). Everything else is a component that plugs into GameObjects (Mesh component, Transform component, etc.)

Over Christmas break, I played around with Rust and I'm really enjoying it. However, I can't figure out a nice way to inherit members from other structs. My current idea, like many others, is to keep a pointer to a "parent" object. So, Duck would have a GameObject, rather than be a GameObject.

Does anyone have any recommendations for better ways I can achieve what I would like to do? I will also accept the fact that inheritance is not needed in a language, but it does make a few situations easier.

Re: Announcing Rust 1.0 Alpha

#82

Being a game developer, inheritance is a really important language feature. I'm not one to abuse the power. Currently, for school I've been working on an OpenGL game engine in C++. It's a component based system. The only real inheritance situation that's important to me, is to allow the user of the engine to create any object and make it inherit from GameObject (example: Duck would inherit the members and methods fro…

Something that addresses your concern is coming post 1.0. Servo needs something like inheritance to model the DOM efficiently. It may or may not end up looking like inheritance, though. We determined that our possible solutions are backwards compatible, so we are doing it post 1.0, though.

(Oh, and Rust doesn't get everything Servo needs, what I mean to say is "Servo has demonstrated that there is real-world need for something like inheritance, and so we will add it.")

Re: Announcing Rust 1.0 Alpha

#83

Being a game developer, inheritance is a really important language feature. I'm not one to abuse the power. Currently, for school I've been working on an OpenGL game engine in C++. It's a component based system. The only real inheritance situation that's important to me, is to allow the user of the engine to create any object and make it inherit from GameObject (example: Duck would inherit the members and methods fro…

Something that addresses your concern is coming post 1.0. Servo needs something like inheritance to model the DOM efficiently. It may or may not end up looking like inheritance, though. We determined that our possible solutions are backwards compatible, so we are doing it post 1.0, though. (Oh, and Rust doesn't get everything Servo needs, what I mean to say is "Servo has demonstrated that there is real-world need for…

That's exactly what I wanted to hear! I heard some mumbles about inheritance coming back in one way or another, mostly on GitHub issues I believe. Can't wait to see what comes of that!

Re: Announcing Rust 1.0 Alpha

#84
post #31

Earlier quoted context omitted.

ARM is well supported, and has been for quite some time. Where did you read that there was no ARM support?

I attempted to install Rust on my ODROID-XU3 (which is running Lubuntu 14.04.1 LTS) just now by running: curl -s https://static.rust-lang.org/rustup.sh | sudo sh The resulting output was: rustup: CFG_CURL := /usr/bin/curl (7.35.0) rustup: CFG_TAR := /bin/tar (1.27.1) rustup: CFG_FILE := /usr/bin/file (5.14) rustup: CFG_SHA256SUM := /usr/bin/sha256sum (256sum) rustup: CFG_SHASUM := /usr/bin/shasum (5.84) rustup: rustu…

Rather than trying to run the compiler itself on a given platform, I'd recommend cross-compiling binaries from a known platform. I'm not an expert in this aspect of Rust, but here's some example Rust code that targets the PSP: https://github.com/luqmana/rust-psp-hello (AIUI the magic is in the psp.json.in file, which communicates a target specification to the compiler).

Feel free to come ask in #rust on irc.mozilla.org if you need some experts to consult!

Re: Announcing Rust 1.0 Alpha

#85
post #69

The one thing that would put rust over the top right now is something along the lines of gofmt - something simple, with zero configuration, that can be run on commit or even save.

indent(1) has been around for ages. Where does this sudden need for universal style goose stepping come from?

Re: Announcing Rust 1.0 Alpha

#86
post #80

Coincidentally, I used Rust for a little board game solver this week and have been delighted by its performance and typechecker feedback! My Scala v1 was was very concise but took ~3 seconds to simulate a whole game. The naive Rust rewrite did it in 0.7 seconds and my current version churns them out at 0.015s each!! http://github.com/iamdanfox/qwirkler if you're curious.. This language is really fun!

Performance is an area where Rust still has a lot of low-hanging fruit to pick, so I'm happy to hear that you managed to make your version fast. Did you have to make any design compromises to that end? We're very interested in optimizing the typical use cases.

I have currently got some bit-swizzling [1] going on to fit the concept of a Piece into u8. (one of 6 colours and one of 6 shapes). I'd like to turn this back into a nice enum if I can!

Introducing laziness by writing an iterator was actually one of the biggest single improvements (I couldn't figure out the syntax for a while, but lifetimes worked much better than I was expecting)!

[1]: https://github.com/iamdanfox/qwirkler/blob/master/src/piece....

Re: Announcing Rust 1.0 Alpha

#87

Coincidentally, I used Rust for a little board game solver this week and have been delighted by its performance and typechecker feedback! My Scala v1 was was very concise but took ~3 seconds to simulate a whole game. The naive Rust rewrite did it in 0.7 seconds and my current version churns them out at 0.015s each!! http://github.com/iamdanfox/qwirkler if you're curious.. This language is really fun!

Could you post the Scala version as well, for comparison?

Re: Announcing Rust 1.0 Alpha

#88

Coincidentally, I used Rust for a little board game solver this week and have been delighted by its performance and typechecker feedback! My Scala v1 was was very concise but took ~3 seconds to simulate a whole game. The naive Rust rewrite did it in 0.7 seconds and my current version churns them out at 0.015s each!! http://github.com/iamdanfox/qwirkler if you're curious.. This language is really fun!

Could you post the Scala version as well, for comparison?

Sure: https://github.com/iamdanfox/QwirkleSolver

The Rust version has had some algorithm improvements to reach 0.015s, but it was conceptually identical when it was solving in 0.7s.

Re: Announcing Rust 1.0 Alpha

#89

Being a game developer, inheritance is a really important language feature. I'm not one to abuse the power. Currently, for school I've been working on an OpenGL game engine in C++. It's a component based system. The only real inheritance situation that's important to me, is to allow the user of the engine to create any object and make it inherit from GameObject (example: Duck would inherit the members and methods fro…

If you want closer performance characteristics and simpler use patterns, in the meantime, storing the parent GameObject by value rather than through a pointer might be easier.

Re: Announcing Rust 1.0 Alpha

#90
post #62

Earlier quoted context omitted.

> I think Python and Go are two examples where the standard library has very much proven invaluable. C#. The amount of time I've wasted in Java programming teams while arguing over things like which of three quirky XML parsing implmentations[1] was the One To Use while the .net team powered off and built useful functionality... [1] This was a few years ago, obviously.

So you prefer not having a choice over having a choice because choice will lead to discussions to pick the best solution. Quite an odd view from a software engineer. I like having as much choice as possible.

Having a standard library for a specific task doesn't forbid alternatives to be implemented and used. But it discourages them enough, which is a very good thing for consistency (especially in reading code), lowers the barrier to entry (eg: I don't have to learn how to parse json with the specific library the project I'm contributing to is using), reduces binary size (I don't link three different http libraries, mine and those chosen by my dependencies) and generically reduce the time wasted by humanity in useless duplications of efforts. When the standard sucks, well, good alternatives will appear.

Also, the sad state of Python packaging is the reason why stdlib bitrotted; technically, your package manager could take care of backward compatibility: if eg at some point in the future you want to switch from a json library to a (far) better one, more in line with how idiomatic language has evolved, you just need to repackage the old one as a third party package, and make sure the packager manager brings it down for the user automatically.

Post reply on HN