←back to thread

611 points LorenDB | 1 comments | | HN request time: 0.203s | source
Show context
choeger ◴[] No.43912866[source]
All this has been known in the PL design community for decades if not half a century by now.

Two things are incredibly frustrating when it comes to safety in software engineering:

1. The arrogance that "practitioners" have against "theorists" (everyone with a PhD in programming languages)

2. The slowness of the adoption of well-tested and thoroughly researched language concepts (think of Haskell type classes, aka, Rust traits)

I like that Rust can pick good concepts and design coherent language from them without inventing its own "pragmatic" solution that breaks horribly in some use cases that some "practitioners" deem "too theoretical."

replies(4): >>43913128 #>>43915349 #>>43916215 #>>43917609 #
Ygg2 ◴[] No.43913128[source]
> I like that Rust can pick good concepts and design coherent language from them without inventing its own "pragmatic" solution that breaks horribly in some use cases that some "practitioners" deem "too theoretical."

I've thought Rust picked some pretty nifty middle ground. On one side, it's not mindfucking unsafe like C. It picked to remove a set of problems like memory safety. On the other side, Rust didn't go for the highest of theoretical grounds. It's not guaranteeing much outside of it, and it also relies a bit on human help (unsafe blocks).

replies(1): >>43913258 #
eptcyka ◴[] No.43913258[source]
As per the article, Rust has benefits beyond the ones afforded by the borrow checker.
replies(1): >>43913710 #
Ygg2 ◴[] No.43913710[source]
Sure, but it is pragmatic in other ways as well :)

It takes ADT, but not function currying, and so on.

replies(2): >>43913760 #>>43913876 #
jeffparsons ◴[] No.43913760[source]
I've occasionally wondered about the lack of currying in Rust; it feels like something that can be done mechanically at compile time, so why not support it? Perhaps to do it cleanly (without more magical privileged functions in core) would require variadic generics?
replies(3): >>43917073 #>>43918247 #>>43922424 #
1. bunderbunder ◴[] No.43917073[source]
You can absolutely curry functions in Rust. You just have to do it manually because there's no syntactic sugar for it.

I think that's a good thing. A curried function is a function that takes one argument, and returns a closure that captures the argument. That closure might itself take another argument, and return a new closure that captures both the original argument and the second one. And so on ad infinitum. How ownership and borrowing works across that chain of closures could easily become a touchy issue, so you probably want to be making it as explicit as possible.

Or perhaps better yet, find an easier way to accomplish the same task. Maybe use a struct to explicitly carry the arguments along until you're ready to call the function.