Live data from Hacker News

Rust Is Surprisingly Good as a Server Language

stu2b50.dev

191–200 of 352 posts

Re: Rust Is Surprisingly Good as a Server Language

#191

Earlier quoted context omitted.

I assume you mean static typing enabled. Because lisps are already dynamically typed to begin with.

Thanks, I actually meant gradually typed systems, like rust typed or closure with heavy spec usage.

Clojure has a java type system which can be partially enforced statically with clj-kondo

Clojure spec is great at system boundaries but it's hard to describe it is a type system, it's a predicate system it can define very arbitrary constraints mostly at runtime

Re: Rust Is Surprisingly Good as a Server Language

#192
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

People seem desperate for one language to rule them all. If you don't need a binary, blazing fast multi-threaded speed, and memory safety then you probably don't need Rust. "Need" being the big thing here. Do you need these things or are they just nice to haves in your head. A scripting language and a web browser can solve a surprising amount of application requirements these days, and its only getting better with time.

Re: Rust Is Surprisingly Good as a Server Language

#193
post #5

I started learning Rusit and using it for hobby projects in 2014, but I have to agree: for a full-blown product development it's just not there yet. Static typing your code up to the point where you can assume it's correct if it compiles and managing memory manually without the need for a garbage collector, these two things alone just light up my inner nerd with excitement. But as an engineer who has to deliver a pro…

People is downvoting you, but you are correct. Rust is ideal for CPU-bound problems were performance is critical. For typical web services, not so much. It is hard to justify the extra development cost, even if hiring were easy (which it isn't in the majority of the world).

Re: Rust Is Surprisingly Good as a Server Language

#194
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

> I keep reading in Rust surveys that Rustaceans just don't care that much about compile times enough to prioritize improving them.

I am interested in how you got that impression, because at least in our official surveys, it's often one of the most-requested improvements to Rust, and it's something that we're constantly working on improving. Still a ton of work to do though!

For what it's worth, my workflow is closer to yours than "compile twice a day." And if you're using rust-analyzer, by default, it compiles the code every save!

Re: Rust Is Surprisingly Good as a Server Language

#195

Earlier quoted context omitted.

In dynamic languages like JavaScript or Python it's necessary to continually run your code in order to validate that the API (of the standard library or of dependencies) was used correctly, that the types match, etc. Rerunning your code continually is no longer necessary in a language like Rust, because the compiler already does that for you. People complaining about slow compile times in static languages like Rust,…

You can have your cake and eat it too, Ocaml & Go both have type systems and compilers that are fast enough to work iteratively

Ocaml is a somewhat fair comparison, but I have to say that Go is really in no way comparable to Rust. Rust is massively more complex.

Re: Rust Is Surprisingly Good as a Server Language

#196
post #64
post #52

Earlier quoted context omitted.

If it is a project you’ve recently built, it shouldn’t matter what’s in your cargo file, since none of that will change from build to build. I wonder what’s broken. How long does it take to build a new empty project? One think that’s helped me stay “in the flow” is switching to rust-analyzer instead of the current official RLS. Much faster, I leave format on save turned on, so `cargo check` output is usually ready in…

A new empty project compiles in under a second. However, adding dependencies will add some arbitrary number to this. Additionally, every hundred lines of code seems to add some amount of time between half a second and a whole second. I did some reading and read that generics are particularly expensive to compile, so I wonder if that accounts for the variance. I can't explain why cargo deps add time, though. I LOVE ru…

Let me put it a stronger way: if you're seeing your cargo dependencies recompile every time, it is a bug. Please file one upstream. These bugs do happen, but they are bugs.

Re: Rust Is Surprisingly Good as a Server Language

#197

Earlier quoted context omitted.

Rust itself is not inherently "low level" per se. But others are probably right that the whole web services ecosystem for Rust is rather half-baked at this time, the OP notwithstanding.

Having to care for memory management is by definition very low level.

It's not really. People working on low-level stuff most likely don't have any dynamic memory allocations at all.

Re: Rust Is Surprisingly Good as a Server Language

#198
post #170

It's sad that we still have to make async I/O explicit in the code to obtain some efficient concurrency in 2020. Async/await is a huge improvement over callback hell, but this doesn't fix everything. The "function color" problem still exists [1], and seems to be more than binary in rust. This quote from the article is incredibly sad: "each async library, comes its own ecosystem of libraries, which only work with that…

> This quote from the article is incredibly sad: "each async library, comes its own ecosystem of libraries, which only work with that async library".

Already in Rust many libraries can be written completely agnostic of the underyling executor. Some cannot; we have a bit more interface work to do, but there's nothing inherent about this, it's solely a standardization issue that's being worked on. Sounds like they ran into the latter more than the former, which is unfortunate, but should be better in the future.

> But is it actually _necessary_ to resort to async I/O in Rust, given that the type system appears to make thread-based concurrency safe ?

It is not!

Re: Rust Is Surprisingly Good as a Server Language

#199

Earlier quoted context omitted.

I can't confirm what is the motivation behind Ada++, but actual Ada2012 standard and in particular the Ada SPARK (2014) subset is in many ways objectively superior to Rust with regards to memory safety. One major issue with Ada is that commercial grade compilers are not cheap and for the most part the language was unable to get rid of the stereotype of being an Aerospace/Defense language only. Some discussion on the…

Does Ada have a substructural type system [0]? If not, then it's not even in the same league as Rust. [0] https://en.wikipedia.org/wiki/Substructural_type_system

From the Ada standard:

https://en.wikibooks.org/wiki/Ada_Programming/Types/access

More importantly the previous discussion on Ada SPARK 2014 'safe pointers' may also be an interesting read for proponents of a Substructural Type System:

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

Re: Rust Is Surprisingly Good as a Server Language

#200
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

> I keep reading in Rust surveys that Rustaceans just don't care that much about compile times enough to prioritize improving them. I am interested in how you got that impression, because at least in our official surveys, it's often one of the most-requested improvements to Rust, and it's something that we're constantly working on improving. Still a ton of work to do though! For what it's worth, my workflow is closer…

Maybe with some heuristics, you could hide some latency by beginning to compile before saving.
Post reply on HN