Live data from Hacker News

How I went about learning Rust

eli.thegreenplace.net

121–130 of 303 posts

Re: How I went about learning Rust

#121
post #82
post #46

Earlier quoted context omitted.

While Go is definitely fast enough for most scenarios, it is not the best language for low level code like drivers or kernel development. Go was never ever intended for this purpose.

Yes, I know (although they promoted it as a "systems language", but it was not really defined what that should mean in the beginning), but it is a restriction, you don't have in Rust. Basically, Rust can do everything Go can do, but not the other way around. That _might_ help to make a decision for a language.

It seems to be an idiom shift. Systems means connected parts, go concurrency does just that, connecting parts through channels. But it's not `systems` as in bare metal electronic chips systems. More like IT `system`.

Re: How I went about learning Rust

#122
post #100

Earlier quoted context omitted.

> Creating a new language and repeating the "billion dollar mistake" by including null (sailing under the brand name "nil" in Go) is just crazy. Can you explain? What do I set ‘score’ to when someone hasn’t sat the test yet?

Read about sum types. They exist in Haskell, Rust, OCaml, Typescript, Swift, Kotlin, etc. You are likely only familiar with product types without knowing they're called product types. (Cartesian product) You can have 100% type-safe, guaranteed at compile time code without null that can still represent the absence of data. Once you've used sum types, you feel clumsy when using Javascript, Python, Go, Ruby, C, C++, etc…

To be fair to Python, the static typing doesn't have the billion dollar mistake (you have explicitly say `Optional[int]`, for eg).

Re: How I went about learning Rust

#123

Earlier quoted context omitted.

Rust actually supports most OOP features, with the main exception of implementation inheritance. And implementation inheritance is a nasty footgun in large-scale software systems (search around for: "fragile base class problem"), in a way that just doesn't apply to simple composition and pure interfaces (traits). So it's hard to fault Rust for including the latter and not the former.

> Rust actually supports most OOP features, with the main exception of implementation inheritance. I've tried some basic OOP. Fields from the base class need to be redefined in each child, and making shared methods private require an ugly workaround. Both concepts are very basic OOP concepts, not advanced or inherently/tendentially dangerous, and the results is that even basic Rust OOP requires a lot of boilerplate.…

Rust itself does not have much support for delegation (the building block for the features you're referring to) since it's pretty much syntactic sugar anyway, but you can use crates like 'ambassador' to provide that.

Re: How I went about learning Rust

#124

Earlier quoted context omitted.

Rust actually supports most OOP features, with the main exception of implementation inheritance. And implementation inheritance is a nasty footgun in large-scale software systems (search around for: "fragile base class problem"), in a way that just doesn't apply to simple composition and pure interfaces (traits). So it's hard to fault Rust for including the latter and not the former.

> Rust actually supports most OOP features, with the main exception of implementation inheritance. I've tried some basic OOP. Fields from the base class need to be redefined in each child, and making shared methods private require an ugly workaround. Both concepts are very basic OOP concepts, not advanced or inherently/tendentially dangerous, and the results is that even basic Rust OOP requires a lot of boilerplate.…

You can define a field with the type of the base class in the subclass, and impl Deref for SubClass, with Target = BaseClass.

Re: How I went about learning Rust

#125
post #60

Earlier quoted context omitted.

What are you looking for in the 2 languages? Here are some of my thoughts: Golang * Development speed: Golang wins by far. It's closer to Python in that regard, but with strong typing. * Very nice multi-threading via Go routines and channels. Impressive semantics in simple syntax, requiring no synchronization mechanism on the user side. * Large garbage collector penalty. Rust * Complete language with build system, cr…

> slow to compile In my experience it's the slowest language to compile ever , and the binaries generated are gargantuan. I was super excited to learn Rust, but that excitement is now 100% gone.

Same. I was about to jump into learning Rust and make it my no.1 language for new projects instead of node.js + TypeScript, but once I learned about the slow compile times I stopped that thought immediately.

Re: How I went about learning Rust

#126

Earlier quoted context omitted.

> but there's no job in That's just not true. Rust got already adopted by lot of either big or interesting to work at players (Amazon, Microsoft, DropBox, ...?) and, while anecdotal, I myself get also paid to program rust. > the community is toxic. > In the rust community, just like a sect, everybody must say that everything is just perfect. I often get the opposite feeling with all the diverse and lengthy discussion…

> Rust got already adopted by lot of either big or interesting to work at players (Amazon, Microsoft, DropBox, ...?) and, while anecdotal, I myself get also paid to program rust. There are very few open positions, though. Just check out the Rust newsletter - the open positions for each release can be counted on one hand. I have the suspicions that Rust positions are typically filled in-house. Shopify, for example, ad…

> Just check out the Rust newsletter - the open positions for each release can be counted on one hand.

IMO there's only a tiny selection on that newsletter, it's just not a canonical source for rust jobs. E.g. and again anecdotal, we don't post our rust job openings there either as such more widely read publications are seldom a good fit, just like the monthly HN "who's hiring" thread - we don't want a flood of applications whom a good percentage of cannot even bother to read the few basic "must haves" for the job.

Also, in house fillings need employees that can program in rust too.

Re: How I went about learning Rust

#127
post #3

I have been thinking to myself whether I should pick up Go or Rust as a new language this year. Coming from a NodeJS background, Rust looks a tad more complicated but it looks cooler. There are also more job listings looking for Golang than Rust which makes me wonder if Golang might be a more rewarding investment? What would be a good use case of Rust than Golang cannot do given its extra complexity and potentially l…

For probably 99% of cases, Go will be a better fit as it is noticeably easier to learn and will require less time to do the task.

Unless you need those extra nanoseconds of performance or super low-level features, Go will be a much better choice.

In the end, they are just tools, and you need to choose them based on your needs, not language features.

Re: How I went about learning Rust

#128

Earlier quoted context omitted.

> What would be a good use case of Rust than Golang cannot do given its extra complexity and potentially lesser monetary reward? Anything where low-level control is required. It's not clear if there are true-Rust web apps in the wild (as opposed to web apps with some services in Rust); as far as I read, Rust web programming is ugly. The market still offers few positions, largely dominated by crypto. I have the impres…

> Anything where low-level control is required. It's not clear if there are true-Rust web apps in the wild (as opposed to web apps with some services in Rust); as far as I read, Rust web programming is ugly. There are. I run one. Written in pure Rust. 160k lines of Rust code in total, serving over 3 million HTTP requests per month. Best choice I've ever made. Rust especially shines when you need to maintain a big pro…

What Rust web libraries/frameworks do you use and recommend? How long does your Rust project take to compile?

Re: How I went about learning Rust

#129
post #62

Earlier quoted context omitted.

> Rust is a better c++ The Rust language is a far better C++. In practice, the compile time and binary size of Rust are out of control, which makes Rust far from being a slam dunk over C++. Crossing my fingers this will change!

I get the sentiment, but like to nuance it a bit. The compile time story of rust and C++ is comparable, if you use it the same way. If you use deep include hierarchies and no precompiled headers, if you start using template heavy code like boost, or if you do code generation, the C++ compile times will quickly spiral out of control. Rust does not have the include problem, but the specialization/templating idea is sha…

Rust has a stable ABI actually, it's called the C ABI. But since most Rust crates do rely on monomorphized generic code in many ways, it's just not possible to share binary artifacts in the first place. (The situation is similar for "header only" libraries in C++.) If you're writing a library that truly does not involve generic code, it makes total sense to expose it via a pure C interface anyway so that languages other than Rust can make use of it.

Re: How I went about learning Rust

#130
post #114
post #49

Earlier quoted context omitted.

Comments like this one below are often downvoted without reply just because they criticise rust: > I founf myself in your same situation a few months ago. I chose Rust and regret it... https://news.ycombinator.com/item?id=32105336 GP puts it well: > Just like in any sect. As long as you agree everything is perfect, the community is the friendliest indeed. The community isn't toxic as long as you happen to agree with…

GP is also wrong. At this point it's mostly a meme. Rust is slow to compile. I mean, yeah if you abuse meta programming or monomorphisation. I've been programming in it, and while I like the language, I'm not on the language community bandwagon. E.g. CoC and it's enforcement (I think it's just pointless grandstanding).

I've seen pretty much zero grandstanding in the Rust community about the CoC. They seem to treat it as any CoC should be treated in practice; a failsafe measure which is most critical for in-person events, and to protect people who make their real-world identity public from aggressive trolling and malicious behavior.
Post reply on HN