Live data from Hacker News

Rust needs a web framework

ntietz.com

371–380 of 395 posts

Re: Rust needs a web framework

#371
post #365

Earlier quoted context omitted.

> You don't need a router when you have pattern matching (just split the url and match on static and dynamic vars however you need) Web frameworks allow for much more: URL redirections, specific management of append-slash and case-sensitive URLs, complex regex matching, etc. > Auth is typically DIY in any language, or SaaS like Firebase/Auth0. It's not a language or framework problem, necessarily False. Django, Larav…

> URL redirection Erm, just return a new url after the match? Get fancy with state machine like enums? Rust has everything you need here, not getting why you think this requires a framework. > Specific management of [...] again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done in a line or two of code > complex regex matching erm, regex crate? > Django, Laravel…

> Rust has everything you need here, not getting why you think this requires a framework.

Because you're reinventing a wheel that doesn't need reinvention, and the most likely thing is that you will neither reinvent it nor pick the best library that an opinionated framework with hundreds of eyeballs has.

> again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done in a line or two of code

Sufficiently large and complex websites will have that need.

> But, if you're building a single product over the course of a year or two, it's not the end of the world to spend a couple weeks rolling your own auth and hook it up to transactional emails and everything else. It's just one small problem to deal with, not major in the grand scheme of things. YMMV

No individual problem is large, but it is objectively a dozen little problems, all with a nontrivial chance to blow up into larger problems.

Code reuse and frameworks exist because, unless you've been doing web development for a long time, you _will_ run into issues that have already been solved.

Re: Rust needs a web framework

#372
post #365

Earlier quoted context omitted.

> URL redirection Erm, just return a new url after the match? Get fancy with state machine like enums? Rust has everything you need here, not getting why you think this requires a framework. > Specific management of [...] again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done in a line or two of code > complex regex matching erm, regex crate? > Django, Laravel…

> Rust has everything you need here, not getting why you think this requires a framework. Because you're reinventing a wheel that doesn't need reinvention, and the most likely thing is that you will neither reinvent it nor pick the best library that an opinionated framework with hundreds of eyeballs has. > again, match for that, map your url parts, whatever - it doesn't need a 10,000 pound gorilla when it can be done…

I don't think you get how powerful Rust's pattern matching is, or how to think of it in terms of a router.

From my example above, check out https://github.com/dakom/dominator-workers-fluent-auth/blob/... and follow it through to https://github.com/dakom/dominator-workers-fluent-auth/blob/...

Do you see that you have static and dynamic parts matching, multiple variable capture, etc.?

I'm not talking from a theoretical perspective. I'm showing you an actual example of a fully baked auth system that does everything on the wishlist (and more) and has no need at all for a router because Rust is itself powerful enough to do all that out of the box

Re: Rust needs a web framework

#373

Earlier quoted context omitted.

This thread is amusing. Go look at job boards. The competition for Go, Rust, Django or whatever is Java+Spring. That's pretty much the industry standard unless you're in a Microsoft-only shop.

It’s disingenuous to leave out C# and F# out of this, given how much closer they are to Rust in language features and how much more “close to the metal” capabilities they offer while also having opinionated web frameworks, better CLI tooling and package management and being generally very productive languages.

I specifically mentioned Microsoft and pointed out that it's mostly gonna be Spring unless in an MS shop. C# wasn't mentioned explicitly because I thought it was clear what was meant.

Re: Rust needs a web framework

#374

Earlier quoted context omitted.

> How did a language that's supposed to be so hard get popular to the point where people view its fans as pushing it aggressively? Popular languages don't really have evangelism or fans pushing it aggressively. Those are traits of smaller languages that don't interop well with other ecosystems so they need a lot of evangelism to build out the library ecosystem. > there's a space for a higher-level language with most…

Rust makes an '.exe', Java makes a '.jar'. I think people want to write programs that run on an OS rather than an interpreter.

You're behind the times. Write a web app using a framework like Micronaut, Spring Native or Quarkus and you'll get a native Linux EXE out of the build system that starts faster than a C program would (due to pre-initialization).

Not that installing Java is all that hard. apt-get install openjdk is sufficient.

Re: Rust needs a web framework

#375

Earlier quoted context omitted.

It’s disingenuous to leave out C# and F# out of this, given how much closer they are to Rust in language features and how much more “close to the metal” capabilities they offer while also having opinionated web frameworks, better CLI tooling and package management and being generally very productive languages.

I specifically mentioned Microsoft and pointed out that it's mostly gonna be Spring unless in an MS shop. C# wasn't mentioned explicitly because I thought it was clear what was meant.

Then the statement is incorrect, unless you want to indicate that it’s region-specific.

Edit: I read other comments. Disregard my replies then, because this is likely intentional. Luckily, I had enough interactions with Java communities to know that many other people there are not biased.

Re: Rust needs a web framework

#376
post #264

Earlier quoted context omitted.

It's an investment in energy efficiency

The advantages of a language like Rust where most interactions are blocked on either user input or network IO are fairly limited. Rust shines when things are CPU or memory bound primarily. Web applications are mostly IO bound. Which is why people have been getting away with fairly poorly optimized interpreted languages for decades. Even when computers were a lot slower than they are today, this worked fairly well.

Energy efficiency is improved even in this case.

Re: Rust needs a web framework

#377

Earlier quoted context omitted.

It is a refutation of the premise which invalidates this particular question as it was posed.

"Not every" is not the same as "none" and the discussion is about the majority, so I think your refutation is only of the absolute case and not of the original premise. Rust would be overkill for most web applications.

Let me put it this way: If I responded to you with "Why should I bother listening to you because you constantly make bad faith arguments" you wouldn't treat the question seriously because (I assume) you do not constantly make bad faith arguments.

It's not that there isn't an answer, it's that there is a problem with the framing of the question itself that should be addressed by the person asking it first.

Re: Rust needs a web framework

#378

Take F# for a spin. It offers nearly all of the type system tomfoolery one craves and all the tooling and nice-to-haves one wants. The big drag is that the async story and memory management aren't as big as a time vampire as Rust, so you do run the risk of actually solving business needs. I am sure some part of dealing with Microsoft can fill that void, though.

Doesn’t f# require the .net virtual machine though? Most people I know picking rust like the fact that it’s compile to native code “always” and predictability and lack of random time of recovery from garbage collection

Re: Rust needs a web framework

#379

Possible unpopular opinion: Rust is a systems language, doing "web work" in Rust is a waste of effort as there are much better languages and ecosystems for that.

It makes sense in systems where memory/CPU is more constrained than normal. A statically compiled web framework can easily use 1/10th to 1/100 the memory/cpu of something like rails or django or flask

Re: Rust needs a web framework

#380

Earlier quoted context omitted.

I specifically mentioned Microsoft and pointed out that it's mostly gonna be Spring unless in an MS shop. C# wasn't mentioned explicitly because I thought it was clear what was meant.

Then the statement is incorrect, unless you want to indicate that it’s region-specific. Edit: I read other comments. Disregard my replies then, because this is likely intentional. Luckily, I had enough interactions with Java communities to know that many other people there are not biased.

How is it incorrect? Do you not see a lot of Spring related jobs in your region? I believe it's true at least for all of Europe.
Post reply on HN