Hacker News new | past | comments | ask | show | jobs | submit login

Does anyone have a link to some examples of non-trivial Rust programs? It looks like a pretty neat language (despite making a few more distinctions than I tend to care about), but I'd like to see how it reads in practice.



I guess the Rust compiler is the most non-trivial Rust program at the moment. You can start there. I've been reading the lexer and parser code (cause I've got to write those for a class) and it's very easy to follow.


Here's a discussion of a ray tracer written in Rust:

https://mail.mozilla.org/pipermail/rust-dev/2011-December/00...

and here's the source code on GitHub:

https://github.com/brson/rustray


I liked the part about 'immutable by default'.

I would love to have that in a language (as long as the 'mutable' keyword was something shorter :-).


> as long as the 'mutable' keyword was something shorter :-

That's one thing I really like, actually: use of mutable structures should be avoided, making mutable structures harder to use (because they require a pretty long extra keyword) is a good way to drive developers towards immutable equivalents. See it as shifting incentives.


OK, but the goal isn't to be Haskell here, or even ML. Those languages have all kinds of support for making immutable-everywhere a feasible goal (and the vast majority of developers still don't use them).

If you want the language to be actually liked by people who develop large systems, it must be designed with its users in mind. 'Nanny' languages tend not to be very popular.

In C++ "reinterpret_cast" is a good example of something that is long and ugly for a reason. But it's also be very rare, probably an order of magnitude or two more rare than mutable in Rust (just a guess).


> OK, but the goal isn't to be Haskell here, or even ML.

So what?

> If you want the language to be actually liked by people who develop large systems, it must be designed with its users in mind.

Which does not prevent the language from driving users towards a goal. One of Rust's goal is emphasizing immutable structures, that's #8 on the front page of its website:

> immutable by default, mutability is the special case

mutability is the special case and a special case Rust tries to make people avoid.

> In C++ "reinterpret_cast" is a good example of something that is long and ugly for a reason. But it's also be very rare

And so ought mutable structures be in Rust.




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

Search: