Live data from Hacker News

A half-hour to learn Rust

fasterthanli.me

311–320 of 342 posts

Re: A half-hour to learn Rust

#311

Earlier quoted context omitted.

Even without if let or match many of those unwraps are unnecessary. See https://github.com/zookini/aoc-2020/blob/master/src/bin/2.rs

Interesting! Can you help me understand why this doesn't work for me? error[E0599]: no method named `parse` found for enum `Option >` in the current scope --> src\main.rs:24:39 | 24 | min: caps.name("min").parse().unwrap(), | ^^^^^ method not found in `Option >`

caps.name("min") returns an Option which you need to handle e.g. by unwrapping. You can use caps["min"] instead if you don't want an option.

Re: A half-hour to learn Rust

#313

New to Rust, was excited to see Prolog anonymous variables make an appearance. But one thing struck me is the mismatch between variable and function declarations... let x: i32 = 42; vs fn fair_dice_roll() -> i32 { 4 } It seems the designers missed an opportunity, as the latter could quite easily have been: fn fair_dice_roll() : i32 = 4; or fn fair_dice_roll() : i32 = { ... code that produces 4... } at the slight expe…

With type ascription being optional in some places, I have to wonder if using the colon for both type ascription and fn return type would introduce any parsing/grammar ambiguities.

I personally like the arrow being used for return types as it highlights pretty well what returns stuff. I don't need to track fn definitions or anything when scanning a file - I just need to look for the arrows.

Re: A half-hour to learn Rust

#315
post #312
post #307

Earlier quoted context omitted.

The assumption that real-world use had not been tried.

An hour isn’t enough to use it on real world use, am I not right?

One way to read your comment, which I think the way others are reading it, is “you only like rust because you haven’t used it much, try it more and you won’t like it anymore.” The implication being that only people who haven’t used Rust can like it.

That may not be what you meant but it seems like that’s what people are understanding.

Re: A half-hour to learn Rust

#316
post #286

I assume Rust doesn’t yet have a comparable library like pythons pipy yet? Ie everything imaginable covered.

crates.io has 52,000 crates. You may not find everything, but you can find a lot of things.

Colour me impressed. Spot check on the python thing I build yesterday has an equivalent

>A rust device driver for the Bosch BME280 temperature, humidity, and atmospheric pressure sensor and the Bosch BMP280 temperature, and atmospheric pressure sensor

Re: A half-hour to learn Rust

#317
post #191

Earlier quoted context omitted.

> I cannot believe that I am smitten by Rust within an hour This has been my, and a lot of my colleagues', experience with Rust. Never have I seen people fall in love with a programming language so strongly. And the love lasts for a long time.

Try to use that in real world and see if your love still stays put. An hour is not enough to validate Rust.

I have been using it for a few years now, and the love is still there

Re: A half-hour to learn Rust

#318
post #191

Earlier quoted context omitted.

Try to use that in real world and see if your love still stays put. An hour is not enough to validate Rust.

Typical condescending HN response. We are using Rust, we've used it to build and ship a successful native desktop app.

I’ve seen a lot of Golang supporters really hate on rust and make this discussion into a holy war

Re: A half-hour to learn Rust

#319
post #312
post #307

Earlier quoted context omitted.

The assumption that real-world use had not been tried.

An hour isn’t enough to use it on real world use, am I not right?

Correct, but the comment you responded to ended with "And the love lasts for a long time."

This suggests experience far more than a single hour, does it not?

Re: A half-hour to learn Rust

#320
post #25

A half-hour to learn Rust Jan 27, 2020 · 51 minute read · rust maybe the site's reading time estimator is broken? sarcasm intended. But seriously, it is good to have people writing things like this.

I'm guessing the code snippets are skewing the estimate.

If anything, code snippets take time to parse and understand what every word and symbol mean. I kept going over "traits" because I didn't get them at first.
Post reply on HN