Live data from Hacker News

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

propelauth.com

161–170 of 496 posts

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

#161

I can't get it why people would prefer to add "?" to everything instead of just having exceptions which automate that behavior. In the bad old days of C there were two kinds of programs: programs without correct error handling, and programs where half the loc are unhappy paths that do what exceptions do... with a huge amount of work. Today people are repeating the same mistakes of the past, putting a "?" on everythin…

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

Exceptions? Which exceptions? How do you know which exceptions you're supposed to be handling and where they come from or when they happen?

I prefer the control flow of the program and the exact types of errors I'm handling to be explicit.

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

#162

Earlier quoted context omitted.

Not sure I agree with Go vs Rust. I think if you would choose Java or Python or C#, then Rust might not be the right choice.

Go is in a sweet spot where it is often used to compete with both groups: [Rust, C/C++] and [Node, Python, Ruby, etc]. The reason GP said it is probably because of Garbage collection. I've done a bit of Rust in my job, and there are some basic things that Rust doesn't have going for it: - steep learning curve (this means for the first 6 months, you or your colleagues are unproductive, write bad Rust which your compan…

> - Verbose. I've seen a just few lines of JS get replaced with hundreds and thousands of Rust.

Please, more detail (=

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

#163
post #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…

That really is a great way to think about it, and my previous experiences with the "wrong choice of Rust" seem so obvious when filtered through this lens.

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

#164

I can't get it why people would prefer to add "?" to everything instead of just having exceptions which automate that behavior. In the bad old days of C there were two kinds of programs: programs without correct error handling, and programs where half the loc are unhappy paths that do what exceptions do... with a huge amount of work. Today people are repeating the same mistakes of the past, putting a "?" on everythin…

They are not the same. Errors force you to explicitly handle unexpected conditions. Exceptions don't. And "?" is for making error handling not take up half of loc. Read up on how exceptions work in C++ implementation-wise. It's not pretty.

That's the problem, though, right? 99.999% of the time you absolutely should not be "handling" an error: you should merely propagate it so it gets closer to code that has actual intent. Languages that force you to try to "handle" errors--which includes Java, due to their botched concept of checked exceptions--both encourage the wrong behavior in the developer and cause the code to be littered with boilerplate to implement the propagation manually.

Meanwhile, they manage to encode the concept of "can fail" into not merely the type signature of a function but into the syntax used to access it, when--like other monadic behaviors, including "requires scoped allocation"--this is the kind of thing you tend to need to refactor into a codebase at a later time: instead, the code should always be typed as if everything can fail and everything can allocate (not just memory, but any resource); languages that get this right--such as C++ and Python--thereby deserve their stickiness.

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

#165

How much more performance do you need to get from Rust over Python (even Cython, PyPy, Numba, etc) to justify the extra development cost? A 2x gain is certainly not worth it. A 10x gain? Maybe. But that is hard to achieve when much of your "compute" is spent on the DB side of things. How many startups actually scale out of needing a few non-db instances?

It will be 25x gain on average and your development costs will triple. Is that worth it? Depends on what you are building....

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

#166

Earlier quoted context omitted.

Not sure I agree with Go vs Rust. I think if you would choose Java or Python or C#, then Rust might not be the right choice.

Go is in a sweet spot where it is often used to compete with both groups: [Rust, C/C++] and [Node, Python, Ruby, etc]. The reason GP said it is probably because of Garbage collection. I've done a bit of Rust in my job, and there are some basic things that Rust doesn't have going for it: - steep learning curve (this means for the first 6 months, you or your colleagues are unproductive, write bad Rust which your compan…

> - Verbose. I've seen a just few lines of JS get replaced with hundreds and thousands of Rust.

I'm curious to see those few lines of JS!

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

#167
post #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…

Three months ago I had made exactly similar comment, it felt nice to me to see the same thought echoed!

https://news.ycombinator.com/item?id=33845045

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

#168

Rust is a systems language, not a business language. If you're building an operating system or a software platform, to for it; the robustness will pay for itself in time to fix hard-to-find errors. But if you're iterating fast to find out what the program should be about to begin with, use a prototype-friendly language instead. With garbage collection.

Well, I had some difficulties writing a tiny init program for a container because process and signal handling are currently in a pretty weird place in Rust.

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

#169

Earlier quoted context omitted.

That doesn't matter if you're writing a REST api. If you're writing a CLI app, then I agree that's a problem.

Sometimes matters, e.g. when you deploy new code.

Not really, just do a rolling deployment like you should be doing anyway. No one cares if the new version takes 1 millisecond to start up or 3 seconds because they literally won't notice.

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

#170
The reason why people would like to pick Rust is because of its ergonomic features like sum types, streams and of course the toolchain.

But here is a claim: Most business-level programmers are not ready for dealing with the borrowing and ownership concept. They don't want to care about reference vs. value types. They can't do memory management efficiently, because most of them have never used a language without GC.

With Rust you would need to care more about memory which is not necessary for most use cases in startups.

Post reply on HN