Live data from Hacker News

Rust 0.2 released

mail.mozilla.org

71–80 of 97 posts

Re: Rust 0.2 released

#71
post #17

Earlier quoted context omitted.

What sorts of compromises does Go make (that Rust does not)?

Pertinent to what I said? Garbage collection is the biggie. Utterly unacceptable in systems work.

Both Rust and Go have GCs. It is true that Rust has mostly per-thread GC, which should help to curb performance concerns quite a bit. And Rust aims to have more explicit control over where things are allocated. But it's still a GCed language.

Whether GC is acceptable in systems work depends on what you construe as "systems work" (kernels and GC don't mix nicely; browsers and GC is OK if you're careful).

Re: Rust 0.2 released

#72
post #54

Earlier quoted context omitted.

You know, there are some things that --to me-- absolutely identify a newcomer to this programming/computer thing. One is the belief that it would be to good to write everything in assembly (from OSs to browsers to games) so that it would be faster. See they heard that assembly is faster and lower-level, so "the more the merrier, right"? Another (that you don't get much nowadays, but there was a time in the early 90's…

Ada is good because of useful typing (such as the ability to say "apples and oranges are both represented as signed 32 bit integers, the allowable range for apples is 0..5, and you can't mix them"), strong control over data representation, standardized extensions for on-the-metal programming and hard real time, built in synchronous message passing concurrency, and just generally being an awesome language. It's also g…

My personal guesses why Ada lost: In (Western) academia was a massive dislike of Ada because of its DoD roots and NATO applications, so they didn't use it for teaching. And hackers disliked it because it was a committee-designed language and it's pretty restrictive (even paternalistic) and directed toward mediocre programmers (a good decision for systems that run over decades and have big, changing teams assigned to it).

What was meant half-joking (that they should use Ada for the browser) becomes better the more I think about it. When I look at Rust's design goals, I find that Ada 2012 fulfills them (at least superficially). Additionally: if users have to learn Rust as a new language, then they can use Ada anyway (which has a good track record, while there's no experience with Rust's possible quirks). And I guess if they ask AdaCore to include certain features as add-ons to their GNAT compiler, they'd do it or assist (because for fun and for the publicity that Firefox uses Ada).

Re: Rust 0.2 released

#73
post #72

Earlier quoted context omitted.

Ada is good because of useful typing (such as the ability to say "apples and oranges are both represented as signed 32 bit integers, the allowable range for apples is 0..5, and you can't mix them"), strong control over data representation, standardized extensions for on-the-metal programming and hard real time, built in synchronous message passing concurrency, and just generally being an awesome language. It's also g…

My personal guesses why Ada lost: In (Western) academia was a massive dislike of Ada because of its DoD roots and NATO applications, so they didn't use it for teaching. And hackers disliked it because it was a committee-designed language and it's pretty restrictive (even paternalistic) and directed toward mediocre programmers (a good decision for systems that run over decades and have big, changing teams assigned to…

I don't know why people think Ada is restrictive, it really isn't at all, at least, not since the Ada 95 revision (which added pointer-to-stack and pointer-to-function and OOP). It isn't even verbose, it's just communicative.

Re: Rust 0.2 released

#74
post #54

Earlier quoted context omitted.

You know, there are some things that --to me-- absolutely identify a newcomer to this programming/computer thing. One is the belief that it would be to good to write everything in assembly (from OSs to browsers to games) so that it would be faster. See they heard that assembly is faster and lower-level, so "the more the merrier, right"? Another (that you don't get much nowadays, but there was a time in the early 90's…

Ada is good because of useful typing (such as the ability to say "apples and oranges are both represented as signed 32 bit integers, the allowable range for apples is 0..5, and you can't mix them"), strong control over data representation, standardized extensions for on-the-metal programming and hard real time, built in synchronous message passing concurrency, and just generally being an awesome language. It's also g…

"apples and oranges are both represented as signed 32 bit integers, the allowable range for apples is 0..5, and you can't mix them"

While I can't say that I completely understand the underlying concepts, I believe that this is the sort of thing that Rust's typestate mechanism is intended to achieve (the way I seem to understand it, it's sort of like design-by-contract, except invariants may be checked at dozens of places per line rather than just at function boundaries). You should look into it if Ada's safety guarantees excite you.

Re: Rust 0.2 released

#75
post #47
post #39

Earlier quoted context omitted.

After a couple of years of writing erlang full-time, tying mailboxes to processes is one of the things that really bugs me. It conflates mutable state, addresses and queues into one construct. Using channels allows multiple writers/readers per queue, passing the channel as a first class value and allows transparent task restarting without needing global address registration per task.

I disagree. I think tying both together produces a new abstraction -- the actor. Not having it that way, offers little more than a thread and a bunch of queues. Presumably you could still use a queue to provide the semantics you want, even now? Or have another actor that acts as the queue. But I think that use case doesn't warrant decomposing actors into channels and tasks.

I believe the idea here is that the language would provide an actor construct as a member of the standard library, built using the concurrency primitives demonstrated above.

Re: Rust 0.2 released

#76

Earlier quoted context omitted.

The ret and crust keywords also irk me. In ye old time Unix tradition, the Rust developers favor extreme brevity. :)

Yeah, I found "crust" to be rather counter-intuitive. I think one of the reasons that bugs me is that "ret" and "mut" don't have any intrinsic meaning in English, but my brain insists on reading "crust" as if it were a word. I'd personally have gone with "rustc".

"rustc" is how you invoke the compiler from the command line, that's no good. :)

I do seem to remember that the devs were passively soliciting ideas for a better name for this keyword. The great thing about a language at this stage is that if this really bothers you, then you can petition to have it changed!

Re: Rust 0.2 released

#77

I don't have a lot of experience with systems programming but want to play around with Rust. Would the best route be to learn C then move onto the untread waters of Rust? I'm just looking for some guidance, this seems really cool to learn.

It's good to understand the underlying systems concepts in general (such as "what is the difference between heap allocation and stack allocation?"), but you don't necessarily need to know C to grok these concepts. However, C is still a good language to know, or at least be familiar with.

As to Rust, there are still a few essential constructs missing from the language, so if you're looking for a gentle introduction you'd probably be better off waiting for 0.3 (scheduled for release in "about a month") or 0.4 (probably due to be released in three months or so).

Re: Rust 0.2 released

#78
post #71

Earlier quoted context omitted.

Pertinent to what I said? Garbage collection is the biggie. Utterly unacceptable in systems work.

Both Rust and Go have GCs. It is true that Rust has mostly per-thread GC, which should help to curb performance concerns quite a bit. And Rust aims to have more explicit control over where things are allocated. But it's still a GCed language. Whether GC is acceptable in systems work depends on what you construe as "systems work" (kernels and GC don't mix nicely; browsers and GC is OK if you're careful).

I'm not an expert systems programmer by any means, but I think that Rust makes a distinction between garbage collection, reference counting, and its region system. There are ways to allocate structures in memory using any of those systems depending on your needs.

If you're willing to be unsafe, it should be possible to avoid most (any?) overhead from automatic memory management. Here's a quote from one of the Rust developers:

"So we basically use the runtime for three things: (a) the task system, which features lightweight threads like Go or Erlang; (b) stack checks and growth; (c) garbage collection. We used to use it for more, but lately more and more stuff has been moved out of the runtime to be written in Rust itself.

"I'd like to see a 'runtime-less Rust' myself, because it'd be great if we could implement the Rust runtime in Rust. This might be useful for other things too, such as drivers or libraries to be embedded into other software. (The latter is obviously of interest to us at Mozilla.) Rust programs compiled in this mode would disable the task system, would be vulnerable to stack overflow (although we might be able to mitigate that with guard pages), and would require extra work to avoid leaks, but would be able to run without a runtime.

"If anyone is interested in this project, I'd be happy to talk more about it -- we have a ton of stuff on our plate at the moment, so we aren't working on it right now, but I'd be thrilled if anyone was interested and could help."

Re: Rust 0.2 released

#79
post #72

Earlier quoted context omitted.

My personal guesses why Ada lost: In (Western) academia was a massive dislike of Ada because of its DoD roots and NATO applications, so they didn't use it for teaching. And hackers disliked it because it was a committee-designed language and it's pretty restrictive (even paternalistic) and directed toward mediocre programmers (a good decision for systems that run over decades and have big, changing teams assigned to…

I don't know why people think Ada is restrictive, it really isn't at all, at least, not since the Ada 95 revision (which added pointer-to-stack and pointer-to-function and OOP). It isn't even verbose, it's just communicative.

I think it comes from the following: Ada was designed to be robust against the average programmer. They prefer to "hack" around and have their program just compiling. Compared to, say, scripting languages Ada ist restrictive. I feel they dislike Haskell for the same reasons.

edit: most complains seem to come from strong typing and static type checking.

Re: Rust 0.2 released

#80
post #3

Rust definitely seems cool as a no-compromises systems language. Why is Mozilla developing it, though? What is the intended use? Supposedly it will be used by Firefox, but for what? Rendering? JavaScript compilation?

I believe it is supposed to be for whatever replaces Firefox/Gecko.

Odd, because their FAQ is quite clear about this:

> Are you going to use this to suddenly rewrite the browser and change everything? Is the Mozilla Corporation trying to force the community to use a new language?

> No. The Mozilla Corporation's involvement is at the labs level: the group concerned with doing experiments. The point is to explore ideas. There is currently no plan to incorporate any Rust-based technology into Firefox.

https://github.com/mozilla/rust/wiki/Doc-project-FAQ

Post reply on HN