Live data from Hacker News

Using Rust at a startup: A cautionary tale

mdwdotla.medium.com

261–270 of 355 posts

Re: Using Rust at a startup: A cautionary tale

#261
post #244

Earlier quoted context omitted.

Rust has many convenient shorthands like the ? operator, where `let x = foo()?` is equivalent to let x = match foo() { Ok(value) -> value, Err(e) -> return Err(e), }

IIRC, `let x = foo()?` is actually equivalent to let x = match foo() { Ok(value) -> value, Err(e) -> return Err(e.into()), } Which can automatically convert one error type into another when the appropriate From and/or Into impls exist.

It is a little more complex than that these days

https://github.com/rust-lang/rust/blob/4e0d0d757e2f1b61ec809...

Re: Using Rust at a startup: A cautionary tale

#262

Earlier quoted context omitted.

Very little --- I'll go ahead and say, to a first approximation, none --- of that safety has anything to do with software security. The same kinds of bugs that hit Java programs hit Rust programs, with maybe the sole exception of deserialization (which has nothing to do with error handling or type safety). That matters because that's the kind of "safety" we're talking about when we discuss externalities for end-users…

Ignoring error codes and left-pad style issues are common sources of security issues. Java is more left-pad resistant than Typescript, granted.

No. Rust doesn't do anything interesting to avoid supply-chain attacks.

Re: Using Rust at a startup: A cautionary tale

#263

Just once I wish I could force a Rust person to use either Ada, or even an Oberon-2 derivative that spits out C code and which compiles in a flash. Then compare the experience...

I wrote a stream-of-consciousness blog post about me trying out Ada back in 2019. https://steveklabnik.com/writing/learning-ada

Re: Using Rust at a startup: A cautionary tale

#264

I'm not sure I agree with the article's premises. Rust can be difficult, yes, but it can also heighten developer productivity above other languages. In Go, I'd have to worry about whether I checked for exceptions via `if err != nil` everywhere, while with Rust, I can depend on the compiler telling me if I haven't done so exhaustively, via the Result type. Same for having algebraic data types or, well, generics in gen…

It's nice to read that someone else has had a positive experience with the zero2prod book. I'm working my way through it and my impression so far (even after reading the official "book") is that Rust is hard; I enjoy the challenges and the eventual realizations, but working my way through some of the chapters that involve implementations, traits, and macros makes me wonder: Would I actually be able to do this myself in a reasonable amount of time, in a professional setting?

Re: Using Rust at a startup: A cautionary tale

#265
post #196

Earlier quoted context omitted.

> I can depend on the compiler telling me if I haven't done so exhaustively, via the Result type That's going to get tiresome after about half a day. Exceptions or GTFO.

I will die on the hill that Exceptions are absolutely terrible for readability and control flow and should die. Result or Go returning many values is wayyyy better.

I'm so convinced that there exceptions are the superior article, that basically there is no hill worth dying on that can even be identified. It would be like saying that I'm going to personally defend a civilized continent against some fringe bushmen armed with flint arrowheads. I've got an army for that, funded by my taxes.

Re: Using Rust at a startup: A cautionary tale

#266
post #210

Earlier quoted context omitted.

Right but my main point is this: Rust comes with additional risk. It is easier to leak memory, it is easier to be unsafe (especially since you can't guarantee what future other devs will do), but you gain nothing. You get all that risk, but fearless concurrency can be done in GC languages (like Elixir) and many people have created the Result type before. So you have added risk for no benefit. Not to mention its easie…

I mentioned the benefits elsewhere. Faster, more throughput, uses far less memory, more ergonomic developer experience (Elixir for example is not statically typed), rock solid stability (my API and anecdotally those of others I hear have never crashed). The risk is small compared to the benefits. I'm not sure why you keep saying there aren't benefits because there are. Now you might not agree they're good enough for…

Fair, but again I think you can get all those things with a GC language.

Speed is the only one you may possibly not, but I think speed is an non-issue. Speed in programming never matters except in the systems space. No one is gonna be able to tell Rust vs Go in a web API and depending on how you do the benchmark, I think many GC languages can probably tie Rust.

Re: Using Rust at a startup: A cautionary tale

#267

I'm not sure I agree with the article's premises. Rust can be difficult, yes, but it can also heighten developer productivity above other languages. In Go, I'd have to worry about whether I checked for exceptions via `if err != nil` everywhere, while with Rust, I can depend on the compiler telling me if I haven't done so exhaustively, via the Result type. Same for having algebraic data types or, well, generics in gen…

> deployed an API that has not gone down a single time since deploying near the beginning of this year

How often does the codebase change? How many people work on it?

Re: Using Rust at a startup: A cautionary tale

#268

> My primary experience from Rust comes from working with it for a little more than 2 years at a previous startup. This project was a cloud-based SaaS product that is, more-or-less, a conventional CRUD app I think this should be at the top of the post. Rust seems like an obvious bad choice for this. For something not performance-sensitive that doesn't require most of Rust's power just use languages/frameworks that ar…

That is the main point of the article. It was a poor choice for what they used it for and most startups aren't writing system (or even desktop) software but are building web apps.

A CRUD/SaaS web team should only be using it for high performance areas with a few microservices. At least until the web side of Rust significantly matures (mostly in the people/community side not just code).

Re: Using Rust at a startup: A cautionary tale

#269
post #266

Earlier quoted context omitted.

I mentioned the benefits elsewhere. Faster, more throughput, uses far less memory, more ergonomic developer experience (Elixir for example is not statically typed), rock solid stability (my API and anecdotally those of others I hear have never crashed). The risk is small compared to the benefits. I'm not sure why you keep saying there aren't benefits because there are. Now you might not agree they're good enough for…

Fair, but again I think you can get all those things with a GC language. Speed is the only one you may possibly not, but I think speed is an non-issue. Speed in programming never matters except in the systems space. No one is gonna be able to tell Rust vs Go in a web API and depending on how you do the benchmark, I think many GC languages can probably tie Rust.

> Speed in programming never matters except in the systems space.

It matters to whoever is paying for compute. If you get some other benefit, it may be a worthwhile tradeoff, but it always matters.

Re: Using Rust at a startup: A cautionary tale

#270
post #40

> We hired a ton of people during my time at this company, but only about two or three of the 60+ people that joined the engineering team had previous experience with Rust. This was not for want of trying to find Rust devs — they just aren’t out there. As an experienced Rust dev, I had the opposite problem. I looked for a good Rust job, but couldn't find one. Took an Elixir job instead. I also don't get the complaint…

> I've worked in a dozen languages, and Rust is still the most productive language for me by far.

Did you work on it with a team in a serious production environment?

Sounds like you struggled to find a Rust job, so I'm not sure how you can know that without really betting on it like these guys did.

Post reply on HN