Live data from Hacker News

What is Rust and why is it so popular?

stackoverflow.blog

251–260 of 284 posts

Re: What is Rust and why is it so popular?

#251
post #186

Earlier quoted context omitted.

I'm not sure I follow. Rust syntax seems far more similar to C than Python syntax does. What parts of the Rust syntax do you feel depart from C-style syntax?

fn add2(x: i32, y: i32) -> i32 { x + y } variable declaration is varname: type, it makes it very hard to read when declaring arrays or other things return type is after the paren the let keyword seems redundant/unnecessary, a little like var in js Those are good example of "c flavor". I guess they're easier to parse, but still I would rather have C flavor instead.

"Very hard to read"? As in, harder to read than the C declaration syntax for the same types? That's a logical impossibility!

Re: What is Rust and why is it so popular?

#252

Still not hyped. The article does not show anything special or new about the language that would attract me personally. Type inference -- nothing new and exists in many other languages. Actually how about compile type inference not only in function bodies? :) Functional niceness with iterators -- also nothing new. It can be even more succinct and elegant in Scala for example. But Scala is not as fast you'd say! Yeah,…

Haven't used Rust, but I don't think your argument makes any sense.

Isn't the point the combination of features is unique?

It seems like if I invented a functional sledge hammer that only weighed 1oz, you'd say:

> It can hammer big nails? So can other sledge hammers!

> It only weighs 1oz? So does a plastic toy hammer!

> So I don't care.

Re: What is Rust and why is it so popular?

#253

Earlier quoted context omitted.

Hey nice to see you here, your SO posts have tremendously helped me learn Rust. I think Haskell is just too abstract for most of us. I love Rust traits and see how it directly came from Haskell but I couldn’t learn Haskell even after like 3 serious tries. Maybe a good portion of the problem is in the documentation and not the language? That said, the extremist purity is simply impractical compared to Rust which gets…

Haskell is easier to learn than Rust because it's literally just math. There is no "dropping" variables and no need to side-step the lack of GC, because you never "drop" a variable that you've stopped using in a math proof. You just let the GC deal with all that stuff. And you don't have a "stack" vs. "heap" distinction, instead you work directly in terms of function arguments and the returned values. You have curryi…

> Haskell is easier to learn than Rust because it's literally just math.

That explains why it was so hard for me to learn: I'm awful at math. The most advanced math I could understand was high school algebra.

Re: What is Rust and why is it so popular?

#254
post #243
post #235

Earlier quoted context omitted.

A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.

That's hardly an honest comparison. I can just as easily split comptime into "type comptime," "value comptime," "comptime blocks," "builtin functions like @isInteger," and "inline control structures" (that one doesn't even use the "comptime" name!). Arguably this combination is more complex than Rust's. It has no way to constrain a comptime type argument (traits), so you get error messages like C++ templates. It has…

> I can just as easily split comptime into

In Rust, generics, macros, traits, compile-time evaluation are different constructs with drastically different syntax (and generics and value generics are different features, implemented at different times, but I can accept them as a single construct).

> It has no way to constrain a comptime type argument (traits)

It does: introspection, just as Clojure can constrain arguments, only Zig does it at compile time.

> so you get error messages like C++ templates

You don't because in C++ templates are programmed in their own sub-language with SFINAE tricks (at least in the C++ versions I use; they've probably added new ways to do this, as they do). In Zig, it's just Zig computation. You'd get similar compile-time errors as you would get, at runtime, in, say, Clojure or Python.

> When you want to combine things, you manage phase ordering and idioms by hand, basically re-implementing Rust-like concepts at every use site.

You don't need to reimplement things by hand at every use site; you just call a subroutine at compile time.

> Sometimes one or two more concepts in the language makes things simpler.

I agree, but I think that Zig's comptime brings revolutionary simplicity to the very complex subject of partial evaluation which is so important in systems languages. How well it would work in practice remains to be seen, and I may well be disappointed, but I find Zig's approach of simplicity first very appealing. I agree it's a matter of taste.

Re: What is Rust and why is it so popular?

#255
post #235

Earlier quoted context omitted.

A single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.

Rust has procedural macros too. And they're not a separate "mini-language" like the C++ template hacks, they just use Rust itself, except with a phase separation involved since they run at compile time.

This is worse. Feature-rich languages like C++ and Rust always end up adopting pretty much every nice feature from every other language. The trick is to have fewer features, not more; at least that's my aesthetic preference. In other words, brag about the features you don't have, not the features you do :)

Re: What is Rust and why is it so popular?

#256
post #34

Over the last couple of months I've been slowly, but steadily playing with Rust. I work on embedded systems and while it's gaining traction only slowly, it feels to me reasonably likely that we'll be seeing non-trivial applications in the next 8-10 years. I doubt that we'll see it used for low-power/resource-constrained firmware, but lots and lots of embedded systems are now bulky Linux boxes with years of uptime, an…

> lots and lots of embedded systems are now bulky Linux boxes

These systems have the resources to run managed runtimes. I’ve shipped embedded software running .NET core 2.2 on ARM Linux (RK3288 with custom set of peripherals), only a minor part of the software being unsafe (a shared library written in C++).

Over the last 20 years, desktop GUI software, web servers, and mobile software migrated from C++ towards managed languages, and they never looked back. I’m pretty sure the majority of embedded software gonna follow the same path.

Re: What is Rust and why is it so popular?

#257
post #173

I realize /r/rust (Reddit) isn't representative of the entire Rust community but it's given me a really bad impression of Rust culture.

Reddit is great for memes and humour, not much more. Go through any subreddit on a topic that you know well, and you'll likely be disappointed.

/r/haskell is pretty good. /r/python isn't great, but not bad either.

There are subredits of every kind, even great ones. But they change with time.

Re: What is Rust and why is it so popular?

#258
post #254
post #243

Earlier quoted context omitted.

That's hardly an honest comparison. I can just as easily split comptime into "type comptime," "value comptime," "comptime blocks," "builtin functions like @isInteger," and "inline control structures" (that one doesn't even use the "comptime" name!). Arguably this combination is more complex than Rust's. It has no way to constrain a comptime type argument (traits), so you get error messages like C++ templates. It has…

> I can just as easily split comptime into In Rust, generics, macros, traits, compile-time evaluation are different constructs with drastically different syntax (and generics and value generics are different features, implemented at different times, but I can accept them as a single construct). > It has no way to constrain a comptime type argument (traits) It does: introspection, just as Clojure can constrain argumen…

> ... generics, traits ...

Again, these are just as much a single feature as Zig comptime. Traits are like comptime types, or else (closer to what Zig does) comptime type variable introspection.

> You'd get similar compile-time errors as you would get, at runtime, in, say, Clojure or Python.

Exactly- you're not writing plain Zig, you're writing a Zig-adjacent dynamically typed language with new ways to do almost everything and different tradeoffs around correctness.

> just call a subroutine at compile time.

Whoever wrote that subroutine did the reimplementation by hand.

Re: What is Rust and why is it so popular?

#259

Earlier quoted context omitted.

Hey nice to see you here, your SO posts have tremendously helped me learn Rust. I think Haskell is just too abstract for most of us. I love Rust traits and see how it directly came from Haskell but I couldn’t learn Haskell even after like 3 serious tries. Maybe a good portion of the problem is in the documentation and not the language? That said, the extremist purity is simply impractical compared to Rust which gets…

Haskell is easier to learn than Rust because it's literally just math. There is no "dropping" variables and no need to side-step the lack of GC, because you never "drop" a variable that you've stopped using in a math proof. You just let the GC deal with all that stuff. And you don't have a "stack" vs. "heap" distinction, instead you work directly in terms of function arguments and the returned values. You have curryi…

GC is OK if the only resource your program needs to manage is RAM; and, in particular if time is not among them. There are many such programs, including the favorites of Computer Science, such as compilers.

Add a single other resource, and now you need resource management. Once you have resource management, memory is the easiest thing to plug into it.

If you start out having resource management, you never wonder whether GC would be a good idea. GC turns into a solution desperately looking for a problem, and finding none in your neighborhood.

Re: What is Rust and why is it so popular?

#260

Earlier quoted context omitted.

Hey nice to see you here, your SO posts have tremendously helped me learn Rust. I think Haskell is just too abstract for most of us. I love Rust traits and see how it directly came from Haskell but I couldn’t learn Haskell even after like 3 serious tries. Maybe a good portion of the problem is in the documentation and not the language? That said, the extremist purity is simply impractical compared to Rust which gets…

Haskell is easier to learn than Rust because it's literally just math. There is no "dropping" variables and no need to side-step the lack of GC, because you never "drop" a variable that you've stopped using in a math proof. You just let the GC deal with all that stuff. And you don't have a "stack" vs. "heap" distinction, instead you work directly in terms of function arguments and the returned values. You have curryi…

Haskell is great if you would rather be doing maths than solving actual, real-world problems. And, either don't care about performance, or like subverting your design to get it.

There are plenty of such people, and they need something to do that keeps them out of the way of people interested in solving real problems efficiently.

Post reply on HN