Live data from Hacker News

Why Rust?

rerun.io

141–150 of 294 posts

Re: Why Rust?

#141
post #12

> Rust's enums and exhaustive match statement are just amazing ADTs + pattern matching are the killer feature set that makes the more popular functional languages so damn pleasant to use, and they're starting to spread to more and more languages. I suspect that, 50 years from now, we'll look back and see them as the key paradigm shift of this era.

I'll bite - I just googled this, and am having a struggle understanding. Is an Algebraic Data Type (ADT) in rust an enum or tuple? I make heavy use of enums (along with structs) as my program foundations. Am I using ADTs? The third type the query shows are unions, which I'm not familiar with.

You are. But benefit depends how your language is utilizing it. Do your function type check your struct input at compile time? Do your condition statement compiled error when you miss addressing a complete set of enum?

Re: Why Rust?

#142
post #12

> Rust's enums and exhaustive match statement are just amazing ADTs + pattern matching are the killer feature set that makes the more popular functional languages so damn pleasant to use, and they're starting to spread to more and more languages. I suspect that, 50 years from now, we'll look back and see them as the key paradigm shift of this era.

This. I have no idea why people underestimate the conceptual power of ADTs. Every time I try to explain this concept they just disregard it as just a convenient wrapper over union...and union isn't THAT common right..? Turns out that having a much better tagged union opens up so many possibilities. Software deals with states and what's better to represent states than an ADT? Last time I was fixing an issue where a mo…

> This. I have no idea why people underestimate the conceptual power of ADTs.

Blub. It's one of those conceptual steps which seems to have no benefit until it actually clicks and you realise how much it opens or does. Being a tremendously good educator is necessary to make people take that step without experience.

Re: Why Rust?

#143
post #87
post #70

> By using Rust for both our frontend and backend, we have a unified stack of Rust everywhere, simplifying our hiring. > I can write web apps in another language than JavaScript > I can write web apps that are fast Yeah, this is what's worrying me. If you look at rerun.io website, you will notice that it's built with Next.js, i.e. is using a React framework to build pages that have no interactivity whatsoever. Next.j…

Rust will never make it to the frontend at scale. There is a reason why JS was invented. People doing frontend dev don't want to bother with slow compile time or 3 strings implementation. And the fast argument is missleading at best, every modern language are "fast" enough, if Amazon and Google runs Java that mean it's fast enough for 99% of workload.

> Rust will never make it to the frontend at scale. There is a reason why JS was invented. People doing frontend dev don't want to bother with slow compile time or 3 strings implementation.

> And the fast argument is missleading at best, every modern language are "fast" enough, if Amazon and Google runs Java that mean it's fast enough for 99% of workload.

IMO, it really depends on the workload.

For the stuff that JS is being used for today, you're probably right.

But say someone wanted to implement a CAD program in the browser. I'd say, JS is probably inadequate for that[1]. In that case, performance matters more than for a chat app.

If you look at web development as a spectrum from webpage+ to high performance application, Javascript is a good fit for a large section of that spectrum. But probably not all of it.

---

1. I suppose it depends on the complexity of what you want to display, but "regular" local applications struggle to display extremely complex models today. I'd imagine putting the software in the browser would only introduce additional performance problems.

Re: Why Rust?

#144
post #117

I don't understand why everyone seems to ignore Ada? Granted I am completely new to it, but from what I see it is years ahead of Rust in terms of safety (it can prove correctness!! Rust is only heading into that direction). Yes syntax is verbose, but I dare to believe there must be another blocker than just syntax?

I did some ADA in the past and yes, it is a nice language, but it lacks the modernity and a dynamic community like Rust. ADA did received some nice update to its specification, but, just like C++, it struggle / cannot really fit the latest innovation in programming language that easily. And to be fair, it is fine. ADA is very much a "committee" language (its spec are ISO/IEC) instead of a "community" language (all the spec and rfc of Rust are on github and anyone can easily discuss them). This makes it so that ADA doesn't get the attention, and the rapidity of innovation, that a language like Rust does, but ADA is mostly made for program that will need to be maintained in critical operations for decades with the code being maintainable and compilable far into the future.

Re: Why Rust?

#145
post #99
post #87

Earlier quoted context omitted.

Rust will never make it to the frontend at scale. There is a reason why JS was invented. People doing frontend dev don't want to bother with slow compile time or 3 strings implementation. And the fast argument is missleading at best, every modern language are "fast" enough, if Amazon and Google runs Java that mean it's fast enough for 99% of workload.

In Rusts defense, I can't think of a situation where you would need `OsString` in a frontend, and I don't think you will need `CString` either since strings are passed into webassembly by address + length (so exactly what Rust expects, no null-terminated nonsense). So you would just use the one default string type (`String` + `&str`).

You shouldn’t ever need to deal with OsString itself on wasm32-unknown-unknown, since that target basically just doesn’t cover functionality that needs it, but the actual situation is genuinely worse than OsString: Rust insists on valid Unicode (as is right and proper), but the web suffers from the affliction of ill-formed UTF-16. If you blindly convert from JavaScript strings to Rust strings, you will encounter data and functionality loss in a few situations, in practice always involving IME (or similar) text entry on Windows. The first bug I filed about this: https://github.com/Pauan/rust-dominator/issues/10, and you can follow further links if you’re interested. IE and Edge used to be largely immune to this, but IE is dead and I suppose Edge will have regressed in this way with the Chromium migration, since the bug filed in Chromium a few years ago https://bugs.chromium.org/p/chromium/issues/detail?id=949056> has languished. (Firefox too, with https://bugzilla.mozilla.org/show_bug.cgi?id=1541349>.) In the worst-case scenario, careless use like was the case in rust-dominator will mean that some users typing with particular software in a language that’s outside the Basic Multilingual Plane will not be able to type anything.

Re: Why Rust?

#146
post #89
post #12

> Rust's enums and exhaustive match statement are just amazing ADTs + pattern matching are the killer feature set that makes the more popular functional languages so damn pleasant to use, and they're starting to spread to more and more languages. I suspect that, 50 years from now, we'll look back and see them as the key paradigm shift of this era.

What makes functional languages so damn pleasant to use is the fact that closures are cleaned up automatically by the runtime system once you're done with them.

Could you give some detail? Is it true for functional language that has mutable data structure and reference as well? How does it clean up, are you talking about "closure conversion"?

Re: Why Rust?

#147
post #9

This must be how people felt about C++ in the beginning ...

No one thought C++ was safe in the beginning. It was very clear with all of the undefined behavior that we were not getting any safety.

Re: Why Rust?

#148

> Rust's enums and exhaustive match statement are just amazing, and now that I'm using them daily I can barely imagine how I could live without them for so long. I feel this! I absolutely love rust's fancy enums - i.e. not just a set of constants, but where each variant can be a full fledged type of its own, and how you have to handle every case whenever you're matching on it. It dovetails absolutely wonderfully with…

Basically ML family languages have them. When you read Rust is ML style, almost 100% sure it's going to have Algebraic Data Types.

Re: Why Rust?

#149

As someone who's not the biggest fan of Rust because of its complexity. There is a big reason to use it today. If you need to use something that has safety guarantees where it's possible to achieve acceptable performance in certain classes of programs where languages like golang, nim or crystal have trouble achieving then I just don't see any other options out there certainly not one with as many libraries available…

What are the major points concerning complexity you have encountered?

Language features. There are many features and language patterns, paradigms which I need to get used to in order to use libraries and read others code. (Similar to C++) I can't even begin to understand macros.

So far it doesn't seem to be insurmountable but it's definitely not what I'd call simple.

Re: Why Rust?

#150

As someone who's not the biggest fan of Rust because of its complexity. There is a big reason to use it today. If you need to use something that has safety guarantees where it's possible to achieve acceptable performance in certain classes of programs where languages like golang, nim or crystal have trouble achieving then I just don't see any other options out there certainly not one with as many libraries available…

Yeah even if I'm a big fan of ML family lang, complexity to solve memory safety is too much to the point Zig is more appealing in way that helps you do it yourself more easily.
Post reply on HN