Live data from Hacker News

Never patterns, exhaustive matching, and uninhabited types in Rust

smallcultfollowing.com

61–70 of 83 posts

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#61
post #53

Earlier quoted context omitted.

Happy to hear that, since I am not exactly in joy of using ancient languages. However, from plans to actual usage takes years; specially for completely new projects using new languages, compilers, libraries, etc. in safety-critical stuff, that takes months just to validate. Stating anything else is just either lying (marketing) or ignorance. Please do not do a disservice to your language by creating vacuous hype.

That was also a significant part of the talk. Like any industry, some shops are conservative, and some aren’t. Pointing out that some places are more liberal than others isn’t lying.

It seems you don’t understand (or more likely you don’t want to understand).

In some industries, companies _must_ be conservative by regulation or by contract: it is _not_ a choice. Trying to sell Rust by saying it is used “in satellites” is simply a PR stunt, and one that discredits your other work.

Prove Rust is controlling critical systems _today_ (the kind that requires paperwork to be signed or insurances to be paid). Otherwise, please stop spreading bullshit.

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#62
post #49

Earlier quoted context omitted.

Here’s the company and product for the sat reference: https://www.kubos.com/kubos/ > For many, software is considered for production only if it has been 5 years in the wild. Time is irrelevant, it’s about usage and stability. Every rust crate I rely on has published download numbers, which give you an idea of number of people using it. In that set, they are all open source and published on GitHub or Gitlab, so I can…

Sorry but that company/product looks like it is a Linux distro and framework tuned/supported for satellite hardware. That does not mean it controls the satellite nor that it is certified. If you think “download numbers” (or open source, or being in GitHub) is a good metric for measuring reliability, it means you haven’t really worked in any such field. It isn’t growing _at all_ in many fields, because it is simply wa…

> If you think “download numbers” (or open source, or being in GitHub) is a good metric for measuring reliability, it means you haven’t really worked in any such field.

I never have worked in such a field, and you're comments about certification, etc, are definitely things I will accept as true. Getting any support of new technology in any space is hard, and of course takes time.

But, I will say that "download numbers" where there is obvious sustained usage of a project is a stand-in for understanding if something is seeing real-world usage. I don't claim that it show stability, only that if it's usage is high and the number of issues on the project are not growing under that strain then you can begin to get a picture of it's stability.

When you talk about formal proofs, certification, etc. Those are different mechanisms for validating that, but generally requires substantial amounts of money to be done.

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#63
post #61

Earlier quoted context omitted.

That was also a significant part of the talk. Like any industry, some shops are conservative, and some aren’t. Pointing out that some places are more liberal than others isn’t lying.

It seems you don’t understand (or more likely you don’t want to understand). In some industries, companies _must_ be conservative by regulation or by contract: it is _not_ a choice. Trying to sell Rust by saying it is used “in satellites” is simply a PR stunt, and one that discredits your other work. Prove Rust is controlling critical systems _today_ (the kind that requires paperwork to be signed or insurances to be…

> (or more likely you don’t want to understand)

I'm not really gonna bother to reply when there's accusations like this.

I do understand everything you're saying. We're not in disagreement about the context. I (or more accurately, bluejekyll, we're talking about the same thing) did provide such a citation, you can take it or leave it.

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#64

Alright this is going to be a dumb question but... Every time I start a new personal project I say 'oh neat I can use Rust!' N hours later (where N is a large number) I realize Go is about as fast, much easier and more readable syntax, and so I use Go if I want something that isn't Node. I'm a web developer so maybe Rust just isn't useful for that, but is Rust purely a systems level language for making super low leve…

I think Rust makes a lot of very hard things possible, at the expense of making some easy things more annoying.

That's a tradeoff that bothers a lot of people who hear the Rust hype, only to find that it's more annoying to write the things they want to write. But if you use Rust and it makes a very hard thing possible, this is an incredibly empowering experience and you'll become a passionate believer. This is a dynamic that leads to arguments on the internet.

I've never done any substantial low-level systems programming, but there are high-level situations where I think Rust was better than anything else.

In one case, I simply couldn't get decent performance for something out of any garbage collected language I tried -- and GC time was the actual bottleneck. Rewriting in C++ seemed very intimidating and likely to be error-prone. Doing the same thing in Rust gave me the same benefits with the confidence that I hadn't made any dumb memory errors.

The second benefit of Rust is that concurrency and parallelism is easy, in the sense that 1) for basic parallelism, you can use Rayon without even thinking about it, and 2) in more complex cases, you can share stuff across threads and be confident that you haven't introduced any weird, hard-to-debug race conditions.

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#65
post #61

Earlier quoted context omitted.

That was also a significant part of the talk. Like any industry, some shops are conservative, and some aren’t. Pointing out that some places are more liberal than others isn’t lying.

It seems you don’t understand (or more likely you don’t want to understand). In some industries, companies _must_ be conservative by regulation or by contract: it is _not_ a choice. Trying to sell Rust by saying it is used “in satellites” is simply a PR stunt, and one that discredits your other work. Prove Rust is controlling critical systems _today_ (the kind that requires paperwork to be signed or insurances to be…

Personal attacks will get you banned here. Programming language flamewars are also definitely not welcome. Please don't post like this to HN.

https://news.ycombinator.com/newsguidelines.html

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#66

Alright this is going to be a dumb question but... Every time I start a new personal project I say 'oh neat I can use Rust!' N hours later (where N is a large number) I realize Go is about as fast, much easier and more readable syntax, and so I use Go if I want something that isn't Node. I'm a web developer so maybe Rust just isn't useful for that, but is Rust purely a systems level language for making super low leve…

Typical that you'd be downvoted just for asking a question

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#67
post #30

Alright this is going to be a dumb question but... Every time I start a new personal project I say 'oh neat I can use Rust!' N hours later (where N is a large number) I realize Go is about as fast, much easier and more readable syntax, and so I use Go if I want something that isn't Node. I'm a web developer so maybe Rust just isn't useful for that, but is Rust purely a systems level language for making super low leve…

I actually often wonder why so many web developers are drawn to Rust. Satisfying a borrow checker just doesn't seem like a worthwhile task when writing web apps. Are there things about Go that you feel are bad enough to warrant a switch to Rust?

[deleted]

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#68

Earlier quoted context omitted.

Firstly stop comparing things in vacuum - you need to set expectations accordingly. Go has google behind it, so regardless of anyone's opinion they can very well jam it down everybody's throat through sheer throwing money at the problem. Go was build for fast web servers, not for what Rust is aiming for at all. Rust also has this this obnoxious issue around it that has become a meme : https://transitiontech.ca/random…

By next year, Google may be the largest single employer of Rust programmers in the world. They might even already be, but the Fuscia team is aggressively hiring. Facebook is too. Amazon had a booth, I didn’t get a chance to talk to them about their current deployment personally. Don’t underestimate China either, PingCap has huge deployments of their database, and while we may not hear about them often in the West, th…

This is a story worth developing further and reporting on

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#69
post #5
post #3

Can someone explain why you'd want uninhabited types? > if you have to define an error type for some computation, but this particular computation can never fail, you might use an uninhabited type. I don't see the reason behind returning a Result if there is no error to return. Why not just return a String?

When you implement a generic trait that is designed to handle errors but your specific case is infallible then it is helpful to indicate that the error case can never occur. Marking that as uninhabited makes it easier for downstream consumers to just eliminate all code related to error handling for that concrete type.

Please don't flame me if this is an ignorant question, but how is uninhabited different from Javascript's undefined? That's what I would use undefined for in JS (very loosely speaking).

Re: Never patterns, exhaustive matching, and uninhabited types in Rust

#70
post #5

Earlier quoted context omitted.

When you implement a generic trait that is designed to handle errors but your specific case is infallible then it is helpful to indicate that the error case can never occur. Marking that as uninhabited makes it easier for downstream consumers to just eliminate all code related to error handling for that concrete type.

Please don't flame me if this is an ignorant question, but how is uninhabited different from Javascript's undefined? That's what I would use undefined for in JS (very loosely speaking).

You can actually set a variable to `undefined` in Javascript. You can't set a value to an uninhabited type─there is no value that represents the type.
Post reply on HN