The example of match usage is really poor. From the looks of it there is no "pattern matching" going on at all here. I don't know the syntax, but even something like this would be a better demonstration:<p><pre><code> let computed_key = match (key.len() > self.block_size, key.len() < self.block_size) {
(true, false) => self.zero_pad(self.hash(key).digest),
(false, true) => self.zero_pad(key),
(false, false) => key
}
</code></pre>
At least there is some matching here, unlike in the original example. But in real world this should be if..else if..else statement, not match - the latter being used makes no sense if there is no matching going on. In Erlang there is an if statement, which is a 'case' (equivalent of match here) but with matches taken out and only guards allowed - that's what would fit here, but I doubt Rust has something like this.<p>Also, does the compiler complain about my example above being not exhaustive? I think in OCaml it would, which is sometimes nice.
I enjoyed the article as I haven't been exposed to much Rust yet, but I was disappointed that the intro didn't match the content<p>The second sentence:<p>> I want a language where I can be much more productive than in C: one in which I do not fear the correctness of my memory management, and don’t have to go through major gyrations to write concurrent code.<p>And we see no explicit demonstrations of the memory management and no demonstrations at all of the concurrency model. It feels like the author had a more fleshed out post in mind, but either decided it was running too long or got bored before reaching the conclusion. :\
Of all the upcoming languages out there. I think rust is best positioned. The fact that it is really the only contender that can preform the same role as C, but it folds in lots of the language design theory of the past three decades puts it in a league of its own.
That seems like a really bad example of pattern matching, as no pattern matching is going on; it's just using the guard statements, and so could be replaced with an if statement:<p><pre><code> let computed_key = if key.len() > self.block_size {
self.zero_pad(self.hash(key).digest)
} else if key.len() < self.block_size {
self.zero_pad(key)
} else {
key
}</code></pre>
I don't think it's fair to compare Rust to Go, while operating on nearly the same level. They are targeting a very different crowd.
Go has very clean syntax, few reserved words and writes almost as easy as python. This makes go a attractive language for programmers who have a history with languages like php & python but also want more speed.
Rust on the other hand has a more complex syntax but allows you more control over memory, thus making it more attractive for those with a history in C or C++.
Go is a good language to learn as your first compiled language, easy to write, easy to learn and a good ratio between performance and effort.
Rust is (or will be when it's stable) a good language to learn when you have a history in C and you want memory & type safety but still the control you are used to in C/C++.
I don't want to turn this into a Go vs. Rust discussion, because the two languages are very different and have very different goals.<p>However, I want to question the claim:<p>> Go is also not particularly friendly to interface to external libraries written in C<p>which doesn't seem to be explained anywhere in the article, and jars with my understanding.<p>Go does play very well with C; cgo[0] makes this pretty straightforward.<p>Maybe there are specific things that the author is trying to do that they found difficult in Cgo, but I would say that Go does play fairly nicely with C; that was a design goal.<p>Here's a simple example of cgo in action: <a href="http://golang.org/doc/articles/c_go_cgo.html" rel="nofollow">http://golang.org/doc/articles/c_go_cgo.html</a>. As you can see, it's relatively straightforward and easy to use.<p>[0] <a href="http://golang.org/cmd/cgo/" rel="nofollow">http://golang.org/cmd/cgo/</a>
I must say i am really surprised about the presented features of the language. It seems to take a lot of the nice things of more dynamic languages and puts them into a fast, compiled system language. I will have to try Rust, now!
Rust looks really great and I would love to switch all of my C development over to Rust but last time I tried to compile it, it took a good hour or two. Has this changed at all?
Why do people keep reinventing syntax? Quick tell me what the following mean:<p>struct Digest { digest: ~[u8] } // what's ~ here?<p>for self.digest.iter().advance |&byte| { acc = acc.append(fmt!("%02x", byte as uint)); }
acc<p>What does the above mean? acc as a separate line and nothing else<p>I hate it when people reinvent the same construct that can be found in other languages but differently. I guess they want to do something different in their language, is it?