4 ms·
I think if Linear/Affine typing was a default anyone wanted, Haskell hackers (who are usually pretty concerned with performance) would regard it as more than a
by benreesman 2y ago
I think if Linear/Affine typing was a default anyone wanted, Haskell hackers (who are usually pretty concerned with performance) would regard it as more than a research oddity.
When people bitch about the borrow checker, what they usually mean is “std::move is a great wristwatch but god damn does it chafe as a chastity belt”.
- mananaysiempre 2y agoGHC Haskell is a fairly large language with a considerable legacy already, so integrating linear or affine types into it may well be a very different question from making a language centered around them. That language exists in the form of Clean[1,2]. Admittedly it’s not really well-known. [1] https://clean.cs.ru.nl/ https://clean.cs.ru.nl/ [2] https://clean-lang.org/ https://clean-lang.org/
- benreesman 2y agoThank you for making me aware of Clean, on quick glance it looks cool. I like a lot of things about Rust: it’s got compiler checked exhaustive pattern match and a good initialization syntax and Either baked in and fucking correct package management and a ton of other things. I’ll look at Clean to see if linear-only memory management can be done gracefully. Rust is a lot of cool things but not the language that demonstrated that.
- MarcusE1W 2y agoThere is also Austral, which has linear types as a main capability: https://austral-lang.org/ https://austral-lang.org/
- zozbot234 2y agoThe whole point of Haskell as a programming language is to have lazy evaluation be the default. This comes with boxing data objects everywhere, which is the opposite of a focus on low-level performance. Haskell does support using strict, unboxed data but it's clunky and not the default. (Also, recent versions of Rust have now added support for "plug-in" laziness via the type constructors LazyCell<> and LazyLock<>.)
- benreesman 2y agoI’m aware of how boxing works in GHC, I learned it from Simon Marlowe. I don’t mean to be obtuse but I don’t see what that has to do with linear typing as a fucking weird mandatory default?
- zozbot234 2y agoI'm not sure what's supposed to be especially weird about linear typing (or rather, uniqueness typing which is what Rust ultimately relies on). If you want to see the use of such types in a language that's clearly even less "convenient" and more principled than Rust, you can look at Austral https://austral-lang.org/ https://austral-lang.org/
- benreesman 2y agoI think I’m going to be a hard pass on a language more militant about BDSM type system level memory management than Rust.
- deleted 2y ago[deleted]
- farmeroy 2y agoIs their code linter called whippy?
- the_duke 2y agoWhy should every language occupy the same design space? Rust was shaped by Mozilla wanting a language to replace parts of Firefox with. A language that is low-level enough to give very high performance, enforces correctness through the type system, and yet has many abstractions so it feels modern and convenient to use. Rust doesn't have any automatic allocations. You can wrap every type in `Arc<Mutex<T>>` and treat it like a very verbose Python, but that's the programmers choice. The design decisions have been validated by the success of Rust in certain domains. There is a reason why more than one programming language exists...