Live data from Hacker News

Rust needs a web framework

ntietz.com

291–300 of 395 posts

Re: Rust needs a web framework

#291
post #204

Earlier quoted context omitted.

I think RC and clone are the way people begin to use Rust. While lots of criticism are against this usage for not idiomatic, it should be acceptable. Coming from Python, nodejs or Ruby, even RC and clone or stack based variables is still a magnitude faster than those languages. When it's about absolute control for performance you can drop down a notch to the borrow checker behavior.

That's an interesting perspective I'd not considered before. Maybe there are different "registers" of Rust, in the same sense that linguists talk about registers in human languages, where you use your language differently for different purposes. And thus, maybe if you're writing something that doesn't need to be screamingly fast absolutely all the time there's a register of Rust where putting lots of things in Rc > i…

I'm gonna plug my Rust "invention" here:

Show HN: How to program in Rust as if it was old school C++ with pointers

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

Re: Rust needs a web framework

#292
post #148
post #87

Earlier quoted context omitted.

I am a fan of Rust for systems programming, but so many people are using Rust for things that are nothing even remotely close to systems programming. So many projects you see being written (or rewritten) in Rust are projects where I just think 'wait, why can't this just have a GC'? And then you look at the code base, and it's all Arc >s, and you can't help at marvel at this, since that's just GC, so what's the benefi…

> What people fall in love with is the rigorous static typing, the Option monad, the exhaustive enums (which are just sum types in disguise), the traits (type classes in disguise), the borrow checker (a half-way house to immutability) etc. I feel like I say this every time this sort of discussion comes up, but I still think that there's a space for a higher-level language with most of what people like from Rust that…

Scala 3? It has the vast Java ecosystem available and state of the art GCs (plural), with either a focus on throughput or low-latency. Also, it can exclude the null value from the type system, marking it explicitly with a union type.

Re: Rust needs a web framework

#293
post #87
post #10

> I like to make silly things, and I also like to put in minimal effort for those silly things. I also like to make things in Rust… I think this part is perhaps the silliest part of a very silly article. If you really like to put in a minimal effort then why on earth would you use Rust? If you want efficiency, memory management and a compiled modern language just use Go. Then you won’t even need anything but the stan…

I am a fan of Rust for systems programming, but so many people are using Rust for things that are nothing even remotely close to systems programming. So many projects you see being written (or rewritten) in Rust are projects where I just think 'wait, why can't this just have a GC'? And then you look at the code base, and it's all Arc >s, and you can't help at marvel at this, since that's just GC, so what's the benefi…

I agree the type system is the best feature of Rust but neither Ruby or Elixir have the level of type safety and type expressiveness of Rust.

I'd recommend Haskell as an alternative, but Rust "fixes" plenty of long term Haskell annoyances (especially around laziness by default, concurrency, unsafe std).

Being able to use Arc>, Rc> and other smart pointers gives you granularity and control over what happens to your memory. I think it's a nice feature to have to mentally reason about your memory usage (incidentally a weak point in Haskell); even if it were on-par with a GC implementation-wise, why use a GC over this?

I like to have control over my code (and I'm probably one of the few who think monad transformers in haskell were a good feature - despite their clunkiness) and I'd pick explicit code over "magic garbage collection in the background" any day. This is not to say I like verbosity for verbosity's sake (eg. think React Redux in JS vs the implementation of the same idea in Elm) but in some cases I think it's justified and it brings extra value.

Re: Rust needs a web framework

#294
post #156

Earlier quoted context omitted.

I'm just really leery of using languages that don't have a clear separation between immutable and mutable state. Having it in Rust catches so many bugs. I also want to write code in languages where you don't have to engage in bad software engineering practices to get optimal performance. That usually means aggressive inlining, something that Rust excels at. edit: the other thing I wanted to mention is that rust's fea…

I think this is a legit sort of reasoning, but in an interesting way it's something where OCaml could fill the gap. It has its ergonomics issues, but I think the issues are basically the same/worse in Rust (except I guess Rust's macro system is better). I say this as a Rust enjoyer, but I take the pain because I _really_ want what I'm working on to be fast.

I like OCaml a lot as a language, but the tooling is very, very poor by modern standards. Poor enough that I think it’s a total blocker on wider adoption.

Re: Rust needs a web framework

#295

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.

For the majority of executing code, there is no fundamental difference when it comes to a JIT compiler.

Besides, GraalVM can produce a native executable for pretty much any JVM language/program.

Re: Rust needs a web framework

#296
post #292
post #148

Earlier quoted context omitted.

> What people fall in love with is the rigorous static typing, the Option monad, the exhaustive enums (which are just sum types in disguise), the traits (type classes in disguise), the borrow checker (a half-way house to immutability) etc. I feel like I say this every time this sort of discussion comes up, but I still think that there's a space for a higher-level language with most of what people like from Rust that…

Scala 3? It has the vast Java ecosystem available and state of the art GCs (plural), with either a focus on throughput or low-latency. Also, it can exclude the null value from the type system, marking it explicitly with a union type.

I think all NVM langs claim interoperability with Java ecosystem. The situation on the ground is never as nice as sold in my XP.

Scala is a great example where I've seen the "best" option being rewrapped libs with scala calls and types rather than a native solution and the dev XP just isn't as good overall.

Re: Rust needs a web framework

#297
post #87

Earlier quoted context omitted.

I am a fan of Rust for systems programming, but so many people are using Rust for things that are nothing even remotely close to systems programming. So many projects you see being written (or rewritten) in Rust are projects where I just think 'wait, why can't this just have a GC'? And then you look at the code base, and it's all Arc >s, and you can't help at marvel at this, since that's just GC, so what's the benefi…

Is Rust only for "systems programming"?

System programmers thinks so.

I guess that if all you do is hammer nails then a multitool is just a hammer.

Re: Rust needs a web framework

#298
post #251
post #226

Earlier quoted context omitted.

> that are nothing even remotely close to systems programming This is unnecessary gatekeeping. It also shows your lack of perspective. Or, rather, your lack of imagining other perspectives, probably. Sure, rust is primarily a language aimed at systems programming. But it also is so much more (and also a cult). * Its type system is excellent. Especially the lack of a "null". Even if, like me, you're fine with a GC, th…

> But it also is so much more (and also a cult). Way to lose readers with memeish statements like that. That said it's in good company of cultists like Smalltalk and Lisp community ;) > * Its "oop" model is uncomfortable at first (coming from Ruby and Java) It's OOP in the sense it has polymorphism, and "methods" . It's not OOP in almost every other conceivable way. It doesn't fit with static OOP of Java. It doesn't…

Rust to me looks a bit like Java. "One owner per resource" is Rusts "One class per file".

I am not convinced that the mental overhead justifies the memory safety guarantees yet. At least for a general purpose language.

I didn't yet write a lot of Rust, perhaps more experience trivializes Rusts ownership model.

Re: Rust needs a web framework

#299

Earlier quoted context omitted.

> TypeScript has an equally powerful type system. How does TypeScript's type system prevent shared mutable state?

When did threading get added to JavaScript? And does Rust have type unions and intersections, interfaces, and mapped and conditional types?

> When did threading get added to JavaScript?

idk. many years ago through stuff like service workers, having shared memory through TypedArrays and similar.

But for the discussion more relevant is that shared mutability constraints do not only matter with threading, they matter with any form of concurrency (like JS async/await/promises and before that callbacks). And even without that you still have other single threaded and single tasked concurrency with the classic being changing a collection while iterating over it. So even without classical forms multi threaded concurrency still very helpful.

> And does Rust have type unions and intersections, interfaces, and mapped and conditional types?

Rusts type system is mainly nominal typed while TS is mainly structural types so it's a bit hard to compare. Like if you nitpick then you could maybe argue that based on TS type system having "features rust types system doesn't have" it's more powerful (but you also could argue the other way around it depends on how you count them). But that would be misleading as it ignores that not only are they two fundamentally different approaches to typing it also ignores that some features are implemented through other means outside of the type system.

Practically having used both I can say that while TS has some things in the typing which are a bit cumbersome to do in rust when it comes to helping me having correct code in context of changes, especially larger changes, and especially libraries Rust still yields better results in my experience. Naturally assuming you don't abuse the TS in either case.

(and to technically answer the question, type unions == yes but different, intersection == no but also make little sense in rust, interfaces == yes but different, mapped types ~= depends on the aspect in some yes and better then TS in other no but implicitly through derives so worse then TS, conditional type ~= again handled through different features depending on usage either associated types or feature gates)

Re: Rust needs a web framework

#300
post #292

Earlier quoted context omitted.

Scala 3? It has the vast Java ecosystem available and state of the art GCs (plural), with either a focus on throughput or low-latency. Also, it can exclude the null value from the type system, marking it explicitly with a union type.

I think all NVM langs claim interoperability with Java ecosystem. The situation on the ground is never as nice as sold in my XP. Scala is a great example where I've seen the "best" option being rewrapped libs with scala calls and types rather than a native solution and the dev XP just isn't as good overall.

You can hardly get higher quality code than what is generally available in Java, especially with their stability. Wrapping it to use the language conventions seems like a pretty solid choice to me.

The dev xp, I sorta agree on, but it has improved a lot.

Post reply on HN