Live data from Hacker News

Announcing Rust 1.0 Alpha

blog.rust-lang.org

221–230 of 255 posts

Re: Announcing Rust 1.0 Alpha

#221

Earlier quoted context omitted.

One reason is that let takes a pattern, so you can do things like: let (x, mut y) = ... Another reason is that we feel 'mut' more cleanly communicates mutability than 'var.' Another reason is that we prefer immutability by default, and let/var doesn't communicate that as nicely as let and let mut. There are some discissions about this on the ML archives, RFC repo, or discuss, if you're interested.

let (x, var y) = ... can easily express the intention. Also, communication is in the ear of the beholder. Var: variable, that varies. 'Let' would be immutable by default. Thanks for the response anyway.

'mut' conveys the same thing you are trying to convey with 'var' in a much better way. The term "variable" in programming languages doesn't carry any connotations of mutability or immutability. All it traditionally means is "named value" or "named memory address".

It's actually entirely reasonable to have an "immutable variable" -- Rust uses this phrase in its error messages and it's perfectly sensible. For example, consider this snippet:

    pub fn is_even(x: int) -> bool {
        let y = (x / 2) * 2 - x;
        if (y == 0) {
            return true;
        } else {
            return false;
        }
    }
Not very idiomatic, forgive me, but would you say that y "varies"? I would say yes, it varies for each invocation of is_even(). If y didn't vary, "if (y == 0)" would be a nonsense statement. y is certainly immutable -- you can't go assigning new values to it -- but it's definitely a variable.

The opposite of "variable" is "a constant," not immutable. 'mut' means "mutable" and "mutable vs. immutable" is the choice here. Rust got this right, I think.

Re: Announcing Rust 1.0 Alpha

#222
post #214

Does anyone know of the Rust Book is available in epub format? Or, if not, but if it's still possible to build one from source, what are the required dependencies I have to install to be able to build the epub?

It would be more useful in a format which works on Kindle, since that's by far the most common. It wouldn't hurt to support both and also pdf. If there was a single page view of the book it would be quite trivial to export it to a single ebook file.

Re: Announcing Rust 1.0 Alpha

#223
Is there a way to parallelize the build?

I just checked out the github repo on a quad core 3.4GHz i7 with 16GB ram, and make -j8 took 37 minutes -- the c/cpp stuff (like llvm) built in parallel, but all the rust stuff did not, such that 7 cores (HT) of 8 were idle for the bulk of the build.

Re: Announcing Rust 1.0 Alpha

#224
post #152

Earlier quoted context omitted.

I'm sure that developing a large application (Servo) in parallel with the language helped quite a bit.

To be fair, rustc is also a pretty huge application that they (and any self-hosted language) developed in parallel with Rust :D (I'm pretty sure I remember hearing that rustc has more code at this point then servo does, but don't quote me on that)

If you just count *.rs files, rust and its in-tree libraries are around 400k lines, and Servo and its immediate dependencies are around 310k lines.

Caveat: use of 'find' and 'wc' is almost invariably totally misleading :-)

Re: Announcing Rust 1.0 Alpha

#225
post #175

Earlier quoted context omitted.

Honestly, it sounds like you are over-engineering this... Forgive me if I'm wrong, but the impression I'm getting here is that you're writing the engine before the game. Never do this. Just don't. What you should do instead, is write a game, and while writing that game, write its engine. At the same time (Or even, write a game, and then refactor the engine out as you go). Then, after you're done, that engine can then…

> Forgive me if I'm wrong, but the impression I'm getting here is that you're writing the engine before the game. Your impression is a little wrong, see below. > Never do this. Just don't. What you should do instead, is write a game, and while writing that game, write its engine. I'm not making a game. We have an OpenGL Game Engine class in my Game Programming program at college. I'm creating my game engine with the…

Examples != a game, and given that scenario, I would recommend trying to make a game at this point, but I'll leave it be.

And that's fair. I didn't think this way until after working in industry for a while, and my code from when I was at school was very high level and OO.

If you're interested, Mike Acton (lead at insomniac, and one of the smartest people in the industry) had a good talk in CPPcon that you can find online about Data Driven design[0], which is basically what I'm talking about (he's a bit more extreme than I am). I'd also recommend looking at his 'Typical C++ Bullshit' slides[1] for a shorter and more amusing take on the issue.

[0]: http://youtu.be/rX0ItVEVjHc

[1]: http://macton.smugmug.com/gallery/8936708_T6zQX#/gallery/893...

Re: Announcing Rust 1.0 Alpha

#226

Earlier quoted context omitted.

I think Python and Go are two examples where the standard library has very much proven invaluable. Without it, it's difficult to be confident in the portability of components, and it quite frankly makes the language less attractive for use. Like the other poster mentioned, I'm happy for the RUST folks to take a "wait-and-see" approach, but at some point, I believe "blessed" components are going to be expected and str…

Python is a prime example of a rotten standard library. Take urllib/urllib2 (use requests instead), unittest (use py.test or nose), os (too low-level, hence arcane usage) or time as examples (use pytz for anything serious), and of course Tkinter. Take all of the modules that solve minor/niche tasks that could easily have been put in a seperate library (e.g. wave), that are usually a bad idea to use (e.g. pickle), tha…

In my experience the batteries included is one of the best features of python. The standard library is fine for simple and small scripts, especially in restricted environments without pip or sudo rights. They are a lot of awesome python libs (like requests) but it is awesome to have the stdlib available everywhere and be able to depend on it.

Re: Announcing Rust 1.0 Alpha

#227

What the status of Rust for Android/iOS?

Every commit is tested against Android. We just merged a PR that improves our iOS support.

Thanks for clarifying. I checked the FAQ and there was a question about Windows support, but not mobile platforms.

For others who are interested, there are instructions here for building Rust for Android and iOS, see "Platforms":

https://github.com/rust-lang/rust/wiki/Docs

Re: Announcing Rust 1.0 Alpha

#229
post #11

> The core libraries are feature-complete for 1.0. Can someone well informed about Rust give some impressions on the standard library? It is as comprehensive as in python or Go for example?

For someone that is new to Rust how do I discover where the libraries are for the things I need to do? In the past year I have needed libraries for HTTP, XML, JSON, CSV, arg parsing, image manipulation, PDF, RDBMS, a trie (and other data structures), async i/o, threads, files, ZIP, and others.

While others mentioned http://crates.io/ you might also be interested in http://rust-ci.org/ (has categories, includes build status and quite often hosted documentation).

Re: Announcing Rust 1.0 Alpha

#230
post #184

Earlier quoted context omitted.

Here's a handy guide: http://arewewebyet.com/

Even assuming all those things are complete, it's not necessarily the best fit for your typical consumer web application. Not unlike how you wouldn't generally turn to C++ for one.

I'd suggest Nim (http://nim-lang.org) as a possible alternative for this use case.
Post reply on HN