Live data from Hacker News

Still in love with Rust

dpc.pw

111–120 of 186 posts

Re: Still in love with Rust

#111
post #104

Earlier quoted context omitted.

> How does data-centric work? How is it different from OOP? Rust doens't have objects. You have structs, which are purely data, and functions, which are purely behavior. OOP puts the two together. So in Rust, you don't tend to design things by saying "what are the objects I need?" but rather "what is the data I am manipulating and how do I manipulate it?" > Also, what opinion rust devs have over golang? I am not 100%…

Oh nice, good to know. > Are you asking why Rust is better than Go? No, just the opinion in general, why rust over go? I know go is more oriented to distributed systems, but it seems like rust eventually will be used for that as well. And I also see golang being used to build just anything, like gopass for example.

Ah. That's a more interesting question, for sure. :)

I got involved with Rust over Go because if I'm going to use a statically typed language, I need generics. That was the initial thing, but other things ended up going similar ways (I think package management is extremely important, for example.)

I think Go has made great choices to accomplish its goals, but I'm personally more interested in a different set of tradeoffs.

Re: Still in love with Rust

#112
post #6

Rust is a wonderful language, but I still have the impression that it is not stable as of 2018. All the toys I've made to play with it during the last years went deprecated quickly, especially if you rely on the ecosystem of packages (web server, database, ...). In addition, there was this thread: https://internals.rust-lang.org/t/concerned-about-rust-2018-... All in all, Rust will be great when stable (including the…

> All the toys I've made to play with it during the last years went deprecated quickly In which sense? That dependencies evolved?

Languages features, dependencies, etc.

For instance one project:

   error[E0010]: allocations are not allowed in constants                          
   error[E0015]: calls in constants are limited to tuple structs and tuple variants
Another:

    error: could not find native static library `brotli`, perhaps an -L flag is missing?
                                                                                
    error: aborting due to previous error                                           
                                                                                
    error: Could not compile `brotli-sys`.                                          
And I'm not talking what happens if you don't fix versions in Cargo.toml.

Re: Still in love with Rust

#113

Earlier quoted context omitted.

Only as good as Rust allows you to be, which is fine for some until they stagnate or grow out of it; but far from the final answer to anything. I don't get at all how being forced to do anything could ever be a good thing. Smells like cognitive dissonance from here. I'm all for powerful tools that enables me to write better code faster; but being forced, really? That's the best thing about Rust? Ew.

> I don't get at all how being forced to do anything could ever be a good thing. So anarchy it is, then?

If those two were the only options, definitely.

But they're not.

Re: Still in love with Rust

#114
post #110

Earlier quoted context omitted.

To clarify two things you've said: 1. Hacker News won't let you downvote someone who replies to you, so it is literally impossible for you to have downvoted in this situation. 2. Both of you are correct, because you're talking about different things. Evgeniy means "You only need to compile your dependencies upon the first build", and you mean "if I use the same dependency in two projects, it will be compiled twice, o…

Thanks for the clarification.

No problem. Others haven't had this conversation as many times as you and I have :)

Re: Still in love with Rust

#115
post #112

Earlier quoted context omitted.

> All the toys I've made to play with it during the last years went deprecated quickly In which sense? That dependencies evolved?

Languages features, dependencies, etc. For instance one project: error[E0010]: allocations are not allowed in constants error[E0015]: calls in constants are limited to tuple structs and tuple variants Another: error: could not find native static library `brotli`, perhaps an -L flag is missing? error: aborting due to previous error error: Could not compile `brotli-sys`. And I'm not talking what happens if you don't fi…

Allocations were never allowed in constants, so I find that first one quite confusing. Any chance you can share the code?

And the second one is because a system library is missing. You're saying you have it installed, and it used to build, but does no longer?

Re: Still in love with Rust

#116
post #14
post #3

“Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” I think this hits the nail on the head for me: abstract structure first, the choice of language C/C++/Rust/... is then a secondary consideration.

Which brings up the question when/why to pick Rust? There are a plethora of languages which from my layman perspective seem more interesting. OTOH there are a plethora of languages with rich ecosystems, proven pedigree and with a high demand for such developers.

I am working on medical devices, where a bug can have catastrophic consequences.

Essentially the ecosystem today is C and C++ for embedded FW and middleware. Even if we are careful, we rely on static analysis tools to avoid some categories of bug. (Plus a humongous amount of tests). Typically bugs that would be caught (mostly) by the Rust compiler at compile time. I think it is a great idea to have some safety guarantee at compile time.

Would Rust fixes every problem ? Absolutely not, you'll always get logical bug or implementation not conform to the requirements but I think it is a move in the right direction, and I hope that slowly in next 10 years Rust will grow in the embedded space.

And overall cargo is nice, C/C++ don't have standard package manager. The test infrastructure is there by default, this is a breeze to add them in your code, rather than relying on an external framework, so this is also good.

I don't really see an alternative today for small footprint SW where C and C++ is king, and I hope that embedded toolchain vendors are taking notes.

If today you mostly code in javascript or python, unless you need bare metal like performance or to have stronger safety guarantee, maybe it does not make sense to move to Rust.

Re: Still in love with Rust

#117
The moment a programmer conflates OOP with 'complicated graphs with lots of interdependencies between nodes', it's the moment I stop reading their writings.

OOP does not force one write complicated graphs of objects. OOP has its applicability, FP has its applicability and well-written code in conventional languages is a mixture of those two.

Re: Still in love with Rust

#118
post #85

I was going to try out Rust, then I saw this on the download page curl https://sh.rustup.rs -sSf | sh Really?

I've been looking at Rust recently, and my conclusion is that it is not production-ready.

It seems like an ever-changing work in progress at the moment, with idiosyncrasies such as this.

Re: Still in love with Rust

#119

Another point against Rust is binary size. If you write the Fibonacci generator in one of the first chapters of the Rust book it will create a 4MB binary. Even stripped it's over 400KB. If you write the same code in Nim it compiles down to 112KB with debug symbols, unstripped. Statically linked against libc (still with debug symbols) it's only 850KB. 850KB statically linked versus ~450KB dynamically linked and stripp…

Rust binaries include jemalloc. However, jemalloc is removed in nightly and by default Rust will use the system allocator: https://internals.rust-lang.org/t/jemalloc-was-just-removed-... This should reduce binary sizes quite a bit.

And some rough numbers, rustc-1.30.1 vs rustc-1.32.0-2018-11-21, building a hello world with --release...

Mac OS:

- 1.30.1 before strip: 573K, after strip: 380K

- 1.32.0 before strip: 267K, after strip: 178K

Ubuntu 18.04 LTS:

- 1.30.1 before strip: 3.9M, after strip: 407K

- 1.32.0 before strip: 2.3M, after strip: 191K

Re: Still in love with Rust

#120
Can someone familiar with both Rust and F# (or OCaml) type systems write few words about the expressiveness aspect of the language?

What would I miss in Rust if coming from the F# background?

Post reply on HN