Live data from Hacker News

A 30-minute Introduction to Rust

doc.rust-lang.org

51–60 of 94 posts

Re: A 30-minute Introduction to Rust

#51
post #50

Earlier quoted context omitted.

> the libraries for the GUI layer are still very immature. This is absolutely true, but that's a different concern than "It would seem that neither Rust nor Go serve this area and probably do not intend to do it either," which is what I'm curious about. One of the open questions with GUI toolkit stuff is that Rust does not have named parameters, but Qt, for example, uses them heavily.

I've only based my impression on a cursory look on the Rust API docs, so I might be wrong, but I did not find any references to database libraries, UI toolkits, multimedia and so on. I did not know about Servo, so I will have to look into it. Will the cross-platform components from Servo be included in the Rust standard library? To give you some background about the kind of apps I was referring to - I am right now wo…

Thanks, that clears it up a bunch.

All of those things are being built yet, so we don't have much to link to. There are a few work-in-progress things, for example, the postgres adapter is coming along, and rust-graphics for graphical primitives. As we get closer to release, and as they mature, we'll feature them more.

> Will the cross-platform components from Servo be included in the Rust standard library?

As we already have a package manager, I think Rust will tend to have a smaller standard library, and encourage its use more. We'll see though.

> am right now working on a UI-driven app that will be deployed to Android and on the desktop.

We support Windows, Mac, and Linux as first-class platforms, and every pull request (and additions are all through pull requests) is tested on android. iOS coming soon.

Re: A 30-minute Introduction to Rust

#52
post #24

Frankly, probably the best introduction to Rust is "Rust by example" [1] This is much more in depth + possibility of running code on site. I don't understand why rust site doesn't have links to this project. [1] http://rustbyexample.com/

> This is much more in depth This is Hacker News, so I'll explain it to you this way: this is specifically _not_ in depth. Have you ever done sales? The idea is that you need to figure out if your customer wants to buy as quickly as possible, and if they don't, move on. If they do, _then_ you move into the longform stuff. If your customer isn't going to buy, it wastes both you and their time. The idea of this short i…

Yeah, an "in 30 minutes" article is probably not going to give you "in depth". It's not meant to.

Re: A 30-minute Introduction to Rust

#53
post #25
post #22

Earlier quoted context omitted.

if C++ doesn't terrify you, you're probably using it too much. C++ is the most complex programming language ever invented.

Yes, it's a big language, but the complexity is at least justifiable, and generally comprehensible. C++ gives you immense power and a huge range of functionality to choose from, and some of the complexity arises from this. It has a very long history, which also contributes to the complexity. And it's first and foremost a pragmatic language, which of course brings in some complexity in order to deal with the inherent…

If I were to use a word, personally, it might be "daunting" instead of "terrifying" but I have at least some experience with C and manual memory management. In that regard C isn't alien to me, so my perception is a little different from the op.

I don't think the parent post was trying to say C++ was necessarily bad, but the features of C++ being justifiable or not don't really impact my feeling of it being daunting, or terrifying to learn. I could say, with reasonable certainty, that every part of a space shuttle launch probably has a good reason for being there, but the system taken as a whole is still intimidating. It's that C++ is a huge beast and there's just so much there. I haven't gone hard core at looking into C++, but every time I do people start of by saying you need to pick a sane subset of the language to work with, and they all have different views of what is and isn't sane. Add to that the fact that you can do some potentially scary stuff when you're close to the hardware, and I can see why it would be a bit scary.

In my view, the right way to approach that, if I were really trying to learn the language, would be to just pick a guide and go with the assumptions it makes until the reasoning for those assumptions becomes more clear and I can better pick and choose according to my use case. But it's still an intimidating proposition.

I'm also guessing that something like Javascript is less terrifying because of previous experience with dynamic languages. The kind of foot-shooting you do in javascript (because of accidental global scoping, poor equality semantics, or any number of things) at least make sense in the context of having programmed in a dynamic, managed language previously. C and C++ can be pretty scary when everyone talks about manually managing memory or being close to the metal or saying stuff about 'systems programming', which just sounds like crazy voodoo if you don't have a point of comparison.

I think the things your saying are all true. Just trying to offer my perspective as to why, those things being true, a language can still be scary to approach. fwiw

Re: A 30-minute Introduction to Rust

#54
post #8

Earlier quoted context omitted.

Just to temper your enthusiasm, the compiler errors can sometimes be irritating, especially when you want to do something the you are pretty sure will be safe. But on the whole if you work with it the pay-off is well worth the minor annoyances. Having the compiler always check your code for memory safety is a huge win for refactoring - C or C++ code bases get really brittle over time as developers forget what is actu…

> C or C++ code bases get really brittle over time as developers forget what is actually going on This is very true. And one of the culprits is a lack of modules, an shortcoming that Rust avoids. A module system for C++ is grossly overdue, and I'm not holding my breath that one will be forthcoming.

What's your definition of a "module" that is not a class, not an object file, not a .so, and not a namespace?

I'm not trying to be argumentative. I've seen this "C++ doesn't have modules" claim before, and I'm trying to get my mind around it.

Re: A 30-minute Introduction to Rust

#55
post #16

How much cognitive overhead is it to think about ownership all the time once you get used to it ? Coming from a GC-languages background I had a hard time thinking in those terms last time I played with it. I ended up having .clone() littered all over the place :)

I find that it's no more mental overhead than it is in C. The nice thing is that the development cycle ends up being faster than C for me because I don't have to spend as much time in front of the debugger.

[deleted]

Re: A 30-minute Introduction to Rust

#56
post #17
post #14

I've only ever used GCed (and largely dynamic) languages up until now (Python, JS and Clojure primarily); C is alien and C++ is frankly terrifying. With all that, I've been having a ball using Rust to solve Project Euler problems, with astonishing speed compared to what I'm used to. It doesn't quite have all the libs you might want for general development yet, but for the things it's currently equipped for it's a lot…

Why do you see C++ as "terrifying"? Yes, it is a very powerful language and there can be a lot to it, but it shouldn't "terrify" you. These days, it's generally quite easy to avoid much of its C heritage (including potential security pitfalls) if using the so-called "modern C++" techniques, but the extra power and flexibility is still there if you do ever need it. There are numerous ways of easily avoiding manual mem…

[deleted]

Re: A 30-minute Introduction to Rust

#57

Who is "behind" Rust? A company, consortium, academics, BDFL? http://www.rust-lang.org/ doesn't have an about page. Didn't see answer listed in the FAQ.

Mozilla is the big driving force, with a small, dedicated group of developers from Mozilla doing a huge amount of the boring 'grunt work', and also making the hard decisions when it comes to design. The community is a huge driving force though, with lots of great contributions being landed all the time.

Re: A 30-minute Introduction to Rust

#58
post #5

I gotta say, reading this actually made me really excited about Rust. C++ without the annoying memory management but no GC-overhead sounds like a dream.

Anecdotally, Rust is the most joyful language to program in for me at the moment. I find that I can express powerful ideas in the type system, with deep confidence that the compiler will catch my mistakes, and a strong mental model of how my program will actually execute. I don't know any other languages that "feel" that way. Perhaps D or Nimrod would, but there's only so much time for new languages...

Re: A 30-minute Introduction to Rust

#59

Earlier quoted context omitted.

> C or C++ code bases get really brittle over time as developers forget what is actually going on This is very true. And one of the culprits is a lack of modules, an shortcoming that Rust avoids. A module system for C++ is grossly overdue, and I'm not holding my breath that one will be forthcoming.

What's your definition of a "module" that is not a class, not an object file, not a .so, and not a namespace? I'm not trying to be argumentative. I've seen this "C++ doesn't have modules" claim before, and I'm trying to get my mind around it.

C++ does not have modules. When people say modules they mean how the files compile, and the current way is #include directives which literally copy-pastes the contents of that file into the includer file. This is horribly horrible for compile times, and has been reviled for basically ever.

Here read this:

http://clang.llvm.org/docs/Modules.html

Re: A 30-minute Introduction to Rust

#60
As someone fairly new to systems programming, I can still see why you'd want to pick a language like Rust over C. But can someone explain to me the difference between Rust and Erlang? They are both system languages, no? Erlang is much more established. But what are the key differences? And I'd ask, "which should I learn?", but that is generally not a great question...
Post reply on HN