Live data from Hacker News

I love building a startup in Rust but wouldn't pick it again

propelauth.com

31–40 of 496 posts

Re: I love building a startup in Rust but wouldn't pick it again

#31
> I can't get it why people would prefer to add "?" to everything instead of just having exceptions which automate that behavior.

Good question... Maybe...

Because with exceptions it's easy to end up with missing cases or unhelpful catch-all exceptions.

Typically with optional values I find that this is not the case for some reason.

Other interesting links I've yet to consume that may help us get closer to an answer this:

https://news.ycombinator.com/item?id=22225170 - "You're better off using exceptions"

https://softwareengineering.stackexchange.com/questions/4050...

https://dannyvanheumen.nl/post/why-i-prefer-error-values-ove...

Re: I love building a startup in Rust but wouldn't pick it again

#32
I've been writing Rust professionally for a few years now and if there's one thing I've learned it's that if you ever write a function that takes a parameter of `impl Fn(&Vec) -> &'a str` you are going to be in for some pain. Just make it `impl Fn(&Vec) -> String`. It is highly unlikely that the extra allocation is ever going to be noticed in the performance.

Just because Rust pretty much forces you to be explicit about your allocations doesn't mean you have to avoid them at all costs.

Re: I love building a startup in Rust but wouldn't pick it again

#33
post #12

Earlier quoted context omitted.

I prefer having extra work done writing code (adding "?") than having to do extra work reading code. Exceptions are functionally invisible control flow; it isn't clear to the reader that a function may blow up if the exceptions are unhandled.

In Swift, at least, the possibility that a function can throw must be marked as part of its signature, and the exception cannot be ignored if it is thrown so the call requires explicit syntax as well, so there is no way to miss that something could "blow up" when reading the code.

It's a little old at this point, but I find the Swift Error Handling Rationale design doc to be absolutely fascinating. It cites other language’s error handling paradigms (including Rust) if you're curious:

https://apple-swift.readthedocs.io/en/latest/ErrorHandlingRa...

Re: I love building a startup in Rust but wouldn't pick it again

#34

Earlier quoted context omitted.

There's some subtlety here: 1. Exceptions have very high performance costs (equivalent to a longjmp which is very slow), so if you expect to have exceptional cases, it's probably a lot more efficient to not use exceptions. 2. Exceptions break the linear flow of the code when you read it, so now you have to read a lot more code to figure out what the exception paths are and where and how they are handled.

> Exceptions have very high performance costs (equivalent to a longjmp which is very slow) Could you elaborate on why they are so slow, compared to passing around/returning error objects explicitly?

They are slow because you need to restore context from an unknown/unpredictable place in the code, you have a table lookup (from a very cold table) to get the next program counter value, and you have to save and restore register values, while the callstack and the calling convention handle all of that complexity for you if you don't break the natural flow of the program.

Re: I love building a startup in Rust but wouldn't pick it again

#35
post #10

This is something I hear a lot from other founders. Spinup time of new engineers is like 6mo+, some devs who can churn out normal CRUD product work just fine in Rails or React ~never become productive with Rust, and hiring skilled Rust devs is just crazy hard (though maybe now that Blockchain/Solidity things have cooled there may be more supply).

6mo+ is spot on. This is true for most dev work that deviates from the CRUD path. Like gaming, simulation, robotics. We might as well use the time to train them in Rust too.

Re: I love building a startup in Rust but wouldn't pick it again

#37
If you're thinking about building something in Rust, a good question to ask is, "what would I use if Rust didn't exist?"

If your answer is something like Go or Node.js, then Rust is probably not the right choice.

If your answer is C or C++ or something similar, then Rust is very likely the right choice.

Obv, there are always exceptions here, but this helps you work through things a bit more objectively. Rust can be a fantastic language for many purposes, but it has a very high development cost.

Re: I love building a startup in Rust but wouldn't pick it again

#40
post #10

This is something I hear a lot from other founders. Spinup time of new engineers is like 6mo+, some devs who can churn out normal CRUD product work just fine in Rails or React ~never become productive with Rust, and hiring skilled Rust devs is just crazy hard (though maybe now that Blockchain/Solidity things have cooled there may be more supply).

> and hiring skilled Rust devs is just crazy hard (though maybe now that Blockchain/Solidity things have cooled there may be more supply).

Sidenote, we hire Rust at a small shop (~30 devs?). Ironically i've found it _easier_ to hire for Rust. You're totally not wrong, BUT, the quality of the candidates that apply is quite high in our experience. I suspect it's because we get a lot of passionate people. We don't have to weed out as many candidates.

With that said we don't aim for super senior devs. We're happy to hire a junior, etc. I care much more about the quality of the person than raw experience.

With that said traditional hiring avenues have not been fruitful for us. Word of mouth, Rust community job posting, etc have been most fruitful by far. Probably due to exactly what you said.

Post reply on HN