Live data from Hacker News

Rust can be difficult to learn and frustrating, but it's also very exciting

influxdata.com

191–200 of 282 posts

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#191

It seems that the main problem with Rust is that it has been grown up not from the CS and PL theory fundamentals , like ML, or Scheme or Erlang or even Go, and it is obviously not a small, clean language everyone loves and appreciates as being beautiful. In other words it is just little better than C++, which is a crap. If a language could be grown from ML (Ocaml) roots (like Scala) instead of C++, it could be much s…

Rust is ML like. It can do pattern matching and has adt type system. It uses expressions rather statements

If you remove gc from ocaml, and added in compensating alternatives it would end up looking something like rust.

I think a lot of the adversting around rust in a "better c++" but its actually ocaml like but not mentioned to avoid scaring away traditional systems devs.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#192

Earlier quoted context omitted.

> Rust is the answer to the question "can we have speed, correctness, and expressiveness in one language?" My biggest gripe is that they left out readability. I like the semantics of Rust, and appreciate the performance and the transparent memory model. I am extremely excited to try Rust on an embedded project. Bur honestly, the syntax is gruesome. Coming from Python, Rust looks like two rabid gerbils had a war dance…

Python is pretty to look at, but I hate working in white space sensitive languages. If I have to have another argument about tabs vs. spaces I am going to toss my monitor out the frickin’ window. Also, it makes autoindent in Emacs worse.

>Python is pretty to look at

Python is ugly and inconsistent as hell due to lack of methods (no maps or reduce in collections for example), indentation, lack of expressions (nearly everything is a statement) and one statement lambdas.

Though rust is beyond good and evil indeed, I really don't get this obsession with brackets and C-like abominations like &*staff. Ada or SML are doing a much better job.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#193

Earlier quoted context omitted.

> "can we have speed, correctness, and expressiveness in one language?" Didn't ocaml already answer that question? Since ocaml hasn't dominated, it seems something more is required... What has rust got beyond that?

Threads and predictable runtime model. (No GC)

Rust does not have predictable allocations, till it would have custom allocators. Malloc is not better than GC.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#194
post #179
post #142

Earlier quoted context omitted.

PEP-8 (more than 15 years old) recommend spaces, so unless you are deliberately looking for a fight, the question is settled. Autoindent is a solution to a problem that doesn't exist in Python in the first place. Having two independent representations for blocks, one for human readers (indent) and one for compilers (braces), leads to nasty bugs when they get out of sync. Autoindent is a tool to keep them in sync. In…

But the tooling for editing the code has no support for indenting blocks as trivially as adding braces. Sure, you just run clang-format or such on the block/file, and get all the visual stuff sorted out.

What editor does not support indenting a block? In most editors I know you select the block and hit tab, or shift-tab to outdent.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#195

Rust is the answer to the question "can we have speed, correctness, and expressiveness in one language?" My company has been running Rust in production for awhile now, and it's exceeded every expectation. It's fast, it's safe, and it's so productive it's hard to find a reason to use anything else. We've also found that the learning curve is, in our opinion, a bit overstated. We've ramped up several new grads on Rust…

A shallow learning curve and cute compiler messages are the least of your problems when doing C++-caliber software. The 'small, easy language for ignorant developers' niche certainly exists, but it's already taken by Go. Rust currently provides no benefit over (modern) C++ for the problems where using Rust or C++ makes sense. (Though perhaps Rust will make it easier for layman developers to learn Rust and then transi…

I doesen't look like you have spent any time investigating Rust at all.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#196
post #176
post #173

Earlier quoted context omitted.

Okay, tell me if this is readable to you: fn accumulate (tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> T where T: From + From , this is JUST the function signature yes, every single thing in there is necessary, it can be written in a more gruesome way, but the where clause clarifies it a bit But let me cheat a little bit ( $(#[$attr:meta])* enum $enumer:ident { $($i:ident => $e:tt $( ( $($m:ident),* ) )* ; )* }…

#1 I find is not worse than C++, granted there's more complexity here than in Python but in terms of cleanness its ok IMHO. Because as you said there's nothing unnecessary. Rust addresses different problems than Python, so we should compare apples with apples. On the second one you got me though, I find the macro syntax a bit horrible. Sometimes I just want simple text substitution.

I'm comparing it to Haskell syntax for the same thing, which is much cleaner

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#197
post #143

Earlier quoted context omitted.

I’m shocked that Rust only gave you a 2X improvement over Python (I’ve rewritten a handful of Python services to Go and typically see 100-1000X improvement). What is the bottleneck? Was scaling horizontally an option?

I suspect the reason it's not faster is one of the following: 1. backend DB at its query limit 2. this is basically my first rust program and I've done something stupid 3. ab/wrk aren't scaling properly either (I know, not likely, but worth considering) when I'm testing it 4. bandwidth/IO limits on the AWS instance types I'm running this on There are other possibilities too I guess. I was mostly doing this as a means…

What web framework are you using?

Are you using a database? If so, which one? Are you using a cache like Redis?

I agree that a 2x speedup is a terribly low for a Python to Rust rewrite and shows that Python is unlikely to be the relevant bottleneck here.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#198
post #176
post #173

Earlier quoted context omitted.

Okay, tell me if this is readable to you: fn accumulate (tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> T where T: From + From , this is JUST the function signature yes, every single thing in there is necessary, it can be written in a more gruesome way, but the where clause clarifies it a bit But let me cheat a little bit ( $(#[$attr:meta])* enum $enumer:ident { $($i:ident => $e:tt $( ( $($m:ident),* ) )* ; )* }…

#1 I find is not worse than C++, granted there's more complexity here than in Python but in terms of cleanness its ok IMHO. Because as you said there's nothing unnecessary. Rust addresses different problems than Python, so we should compare apples with apples. On the second one you got me though, I find the macro syntax a bit horrible. Sometimes I just want simple text substitution.

C++ templates also aren't winning any readability awards.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#199
post #173
post #157

Earlier quoted context omitted.

>Bur honestly, the syntax is gruesome. Coming from Python, Rust looks like two rabid gerbils had a war dance on my keyboard. What exactly is terrible about it? The snake_case I got used to, I kind of like having braces, and that's not really a killer argument either, because most languages have them, apart from that I find Rust also much cleaner than Python syntax. I'm really not sure what you mean. Is it the lifetim…

Okay, tell me if this is readable to you: fn accumulate (tuples: &[(&'a str, &Fn(i32) -> bool)], i: i32) -> T where T: From + From , this is JUST the function signature yes, every single thing in there is necessary, it can be written in a more gruesome way, but the where clause clarifies it a bit But let me cheat a little bit ( $(#[$attr:meta])* enum $enumer:ident { $($i:ident => $e:tt $( ( $($m:ident),* ) )* ; )* }…

It is somewhat unfair to compare this to Python, since a lot of the simplicity in Python comes from the semantics (dynamically typed, garbage collected and so on). Rust need to express all this information (types, lifetimes etc.), so it will necessarily be more dense. The question is if this information could be expressed in a more readable syntax. This might be possible, but I would like to see a suggestion of how.

I guess the signature could be made more readable by using a few type aliases. The hardest part to read is the nested types.

I'm with you on the macro syntax, it is very hard to read. It is not easy to create a readable macro syntax though. All languages I know have hard-to-read macros, so this is not yet a solved problem.

Re: Rust can be difficult to learn and frustrating, but it's also very exciting

#200
post #196
post #176

Earlier quoted context omitted.

#1 I find is not worse than C++, granted there's more complexity here than in Python but in terms of cleanness its ok IMHO. Because as you said there's nothing unnecessary. Rust addresses different problems than Python, so we should compare apples with apples. On the second one you got me though, I find the macro syntax a bit horrible. Sometimes I just want simple text substitution.

I'm comparing it to Haskell syntax for the same thing, which is much cleaner

Haskell does not have borrowing and lifetime specifiers though, which is what makes the Rust example more dense.
Post reply on HN