222 points · by steveklabnik · 13y ago · 96 comments
Just wait until it's done. It will be a really great HTTP library.
For example, last week as a learning exercise I implemented an OAuth client, which involves adding a bunch of stuff to the "Authorization" header of an HTTP request, none of which was ever mentioned in the original HTTP RFCs, let alone specified. Likewise, the HTTP RFCs have a fixed and rather small set of verbs, but things like DAV add a bunch more.
How can you balance the reliability of strict typing with all the HTTP extensions that expect anyone can stick arbitrary strings anywhere?
Then it would be not just great PR for their "highly-optimized no legacy cruft 64-bit browser", but would also give people a reason to switch from Firefox to it. It would also give Mozilla an excuse to not make a 64-bit Firefox anymore.
I assume it's going to take them at least 2-3 years to do it (if they ever plan to release it), and by then Microsoft will probably release a 64-bit only Windows 9, iOS will be 64-only, too (probably not relevant to Mozilla, but could be in the future), and at least half of all Android smartphone users will have ARMv8-based devices.
Mozilla should take full advantage of this, and really push for performance (and security), and they should only make it available from Android 5.0 (probably the first 64-bit Android version) and Windows 7 x64. Support for Linux kernel should probably start with no lower than 3.10 LTS (contains all the ARMv8 support).
The extra parallelism we're after also enables new things too. For example, Servo runs cross-origin and sandboxed iframes in parallel.
And this: http://people.mozilla.org/~roc/Samsung/MozillaRustAndServo.p...
Very few of today's apps actually benefit from having more than 3GB of address space. Nothing on my desktop PC is using more than 300MB at the moment. All else being equal, 32 bits will be more efficient, particularly on portable devices which tend to have far less memory bandwidth.
They're released on a schedule, not by features. They're useful to be able to refer to periods of time in Rust's rapidly changing lifetime, but not much beyond that.
Specifically, maturity #5 - production ready: https://github.com/mozilla/rust/issues?milestone=16&state=op...
> The purpose of this milestone is to represent a high degree of confidence the
> language's suitability for industrial use due to a high level of measured
> correctness and performance in the tests.
> In other words, for each of the aspects described in the "well covered"
> milestone, and for each supported target platform, test success and benchmark
> performance has reached a level deemed suitable for production use in
> environments with substantial business consequences for major defects or low
> performance. Where possible, performance benchmarks are linked to equivalent
> benchmarks in competitive languages, and rust is sufficiently close to
> equivalent in performance. > maturity #2 - backwards compatible
> we are comfortable making a long-term support commitment to downstream
> users (servo in particular) to keep the set of symbols, definitions
> and passing-tests from contractingNot a critique by any means--I admire the language and the work being done. More of a wish that the core language syntax would settle down soon.
In this regard it couldn't be a better time to try it out.
That doesn't mean that your sentiment is wrong; if you don't want to be keeping up with the langauge's changes, certainly don't write projects in Rust. That said, there are more libraries than you'd expect, including a few that are several thousands of lines.
Yeah, only the entire for loop syntax changed. ;)
I wouldn't devote a crucial project, school assignment, or startup to rust. But for some toy side projects, or small programs, it's not so bad right now.
I did a project in Rust as a learning exercise. The language is easy to pick and I was able to hit the ground running from the start. The major learning hurdle I think is the memory model, which is different from most languages out there.
Here's my first Rust project after two weeks of on and off hacking. It's a Memcached client library implementing the Memcached protocols in pure Rust. https://github.com/williamw520/rustymem
Any suggestions welcome, here or via email.
2) The use of pointer dereferencing in closures is still quite confusing to me. For example, from the tutorial:
let square = |x: int| -> uint { (x * x) as uint };
no pointer dereferencing, yet: [1, 2, 3].map(|x| if *x > max { max = *x });
uses pointer dereferencing. I can't figure out any rhyme or reason behind it.3) How do you create traits that can be automatically derived? How do you implement a default method?
4) How do you create and use macros, and in what situations are they the appropriate solution over other forms? (I'm used to using macros in lispy languages, but using them as pervasively in other languages seems to be a form of code smell).
As for the pointer dereferencing, perhaps putting the type there will make it clearer:
[1, 2, 3].map(|x: &int| if *x > max { max = *x });
Now you can see that x isn't actually an int but a reference to one.As for automatically derived traits, those are actually slightly more powerful macros implemented in the compiler itself. You can see it at rust/src/libsyntax/ext/*.
For default methods, you just put the code you want in the trait itself. Like so:
trait Animal {
fn sound(&self) -> ~str;
fn make_sound(&self) {
println(self.sound());
}
}
The make_sound method is what's called a default method. If you implemented that trait, at the very least you would have to define the sound method and if you wanted to, you could override the default make_sound method.Macros are actually created with another macro called macro_rules. I'll defer to the tutorial for them: http://static.rust-lang.org/doc/0.8/tutorial-macros.html
I would say to follow a Lisp rule, I like to follow in all languages that have macro support, "only implement a macro if it cannot be done with a function".
Would be great if the docs just linked straight to the function/crate in github.
(That feature has yet to be ported to the Rust port of the HTML generator though.)
If you want to chat feel free to stop by `#rust-gamedev` on irc.mozilla.org. We're very nice!
I have a toy web project I'm starting. Would love to play with Rust.
Of course, if someone wants, they can totally do something via FastCGI too.
Is the new fixed-stack FFI arrangement the end goal, or is it a stepping stone to a different system? It seems as though always using a big, fixed stack would cause performance/memory issues. Could the compiler detect which Rust fn's call extern "C" functions so I don't have to write annotations? Thanks!
There were long discussions over how "smart" the extern stack-size strategy should be. The current arrangement is, as ever, a compromise. In practice, most people writing bindings to C from Rust will wrap the C call into a very thin wrapper function whose job is to handle type conversions and managing the necessary `unsafe` bits. The hope is that putting the annotation on these wrapper functions won't be very onerous, with the result that any Rust code that calls the wrapper functions won't ever have to bothered with remembering the annotations.
If you want to try working on it yourself, come join the community! You'll get lots of help with it when you need it.
When will we be able to compile Rust using a standard LLVM instalation, instead of compiling LLVM with it?
My poor netbook takes almost 3 hours to compile it. :(