Talk:Rust (programming language)/Archive 1

From Wikipedia, the free encyclopedia

Archive 1Archive 2Archive 3Archive 5

Secod code example: else necessary?

Hi. Im not that good with rust or other prog. languages but in the second code example:

fn fac_recur(n: int) -> int {
    if n <= 1 { 1 }
    else { n * fac_recur(n-1) }
}

Is there the "else" really necessary? I mean if the first "if" statemant is not true you will automaticly return n * fac_recur(n-1) with and without else right? — Preceding unsigned comment added by 178.4.179.35 (talk) 13:04, 21 December 2012 (UTC)

If I understand correctly, you're suggesting removing the else block but keeping the n * fac_recur(n-1) within it. That would actually change the behaviour of the program, because the 1 expression above it would never be returned. (That could be mitigated by changing { 1 } into { return 1 }, however it's better Rust style to use implicit returns.) Hope that makes sense! Thanks. Hexene (talk) 12:31, 29 December 2012 (UTC)
I concur with Hexene. Much of the interest in that code example is to demonstrate that `if` is an expression with a return value, which is a foreign concept to anyone familiar with only C/C++/Java. To demonstrate this, the `if` needs to be the last expression in the function. As Hexene notes, this is also a very common style in Rust, and is a good demonstration of idiomatic code. Kibwen (talk) 16:35, 4 January 2014 (UTC)

Why are they not using Rust for Firefox?

So this is a good new language. But why is not even Mozilla using this?! Like for firefox? Its somehow funny, that they create an own language - but they are not using it. — Preceding unsigned comment added by 178.4.189.157 (talk) 09:00, 26 January 2013 (UTC)

See Servo (layout engine). Rust is still an experimental programming language under heavy development. It is being designed by Mozilla specifically to rewrite their entire layout engine in it. Programming languages and layout engines, however, are complicated things that take years to develop from scratch like this.
I think it will take at least another two years for a Rust-based rendering engine to be, or start to be, viable for real world usage. Servo has yet to pass the Acid1 test, and is using all manner of temporary components (such as libhubbub, the NetSurf HTML parser) whilst Rust replacements are being designed and written. As an outsider looking in, I have great faith in the project, but it will take time. Hexene (talk) 20:13, 8 April 2013 (UTC)
FYI, Servo now passes Acid1 test. Sanxiyn (talk) 08:03, 3 October 2013 (UTC)
Two years was a good guess :) Servo is getting close to usable and Mozilla is starting to integrate some of its components in Firefox. DdEe4Aai (talk) 18:19, 7 May 2015 (UTC)

Performance of Rust compared to C++

De-primary source-ification

"Appeared in" infobox date

Influenced by Scheme?

"Relies too much on primary sources"

The Goal of Rust

Linear vs. affine typing

Source of Rust's name

List of "Project using Rust"

Actor Concurrency Model

Related Articles

Wikiwand AI