4 ms·
Seems like a strange pair of languages to compare/contrast given that they are for such different use-cases. The cognitive overhead of programming Rust need onl
by thelazydogsback 6y ago
Seems like a strange pair of languages to compare/contrast given that they are for such different use-cases.
The cognitive overhead of programming Rust need only be applied if you're programming systems or code that need fine control over memory. OCaml is a general purpose language with GC and much higher levels of abstraction that can be quite performant - or F# (for OCaml-like) or other mainstream ecosystems like .netcore or jvm that a much wider choice of libs than Rust. (And these also usually have a path to native or js and/or webasm.)
I really don't get the whole "rewrite it in Rust" thing at all, especially when 95% of those applications would be perfectly performant in a language that lets you focus on your domain, not on making the borrow-checker happy.
IMHO if your code is scoped to the lifetime of a call or transaction of some sort or has very simple allocation needs, then fine -- but if you want to have complex inter-relationships between objects and interesting data-structures in a long-running process then you're in for a world of hurt.
- asplake 6y agoBut this is what I don't get. Why is OCaml (or some other language of ML lineage) not a more accessible platform for web development? Or perhaps it is, and I'm not seeing it? Prove me wrong here – I'd be delighted! I'm not sure that Rust is there yet either mind you, but give it time, perhaps it will...
- avasthe 6y agoThey didn't have corporate backing. They didn't have aggressive marketing or zealous community. They didn't have massive influx from ruby rails or javascript webshit crowds.
- thelazydogsback 6y agoI've used F# for many web projects - server side and transpiled to client-side. For example, see: https://safe-stack.github.io/ https://safe-stack.github.io/ Also: https://www.purescript.org/ https://www.purescript.org/
- cemerick 6y ago> Why is OCaml (or some other language of ML lineage) not a more accessible platform for web development "Web development" is a grueling land war that requires massive investment in foundational libraries and fairly sophisticated tooling just to do a modern "hello world" app. Any language/platform that isn't explicitly dedicated to "web development" will always be lagging many generations behind those that do (i.e. rails and waves hands javascript). I agree with the sentiment that Rust and OCaml aren't really peers. More generally, the urge to transition to Rust in general application development is as puzzling to me as it is to your parent here: it has unique benefits for systems programming, but that absolutely carries costs for a ton of non-systems contexts where you could just as easily use OCaml, or (modern) Java, or ...
- pbiggar 6y agoBoth are systems programming languages (OCaml describes itself as such). The rewrite in Rust thing, for darklang at least, comes from the 50th time we've had to do something bad and ugly to fit into what is supported by OCaml.
- thelazydogsback 6y agoWas there something about F# on .netcore you didn't like? Would make a re-write much easier, I'd think.
- pbiggar 6y agoI've thought about it a few times, I'm so far from that ecosystem that I know nothing about it at all
- ltrls23 6y ago> the 50th time we've had to do something bad and ugly to fit into what is supported by OCaml Can you tell us a bit more about those cases? I've been writing front-end stuff using BuckleScript (and the OCaml syntax, which I for once really like!) for 6 months, and I haven't (yet?) stumbled upon those kind of pain points, I'm definitely curious!
- wtetzner 6y agoNot the OP, but my biggest issues have been around tooling.
- ssokolow 6y ago> I really don't get the whole "rewrite it in Rust" thing at all, especially when 95% of those applications would be perfectly performant in a language that lets you focus on your domain, not on making the borrow-checker happy. Generally, people who actually know what they're talking about see RIIR as being less about performance and more about getting stronger compile-time correctness guarantees than are available from languages with nullable types (holes in the type system), exceptions (hidden control flow paths), no sum types (limited ability to "make invalid states unrepresentable"), etc. In that respect, Rust serves more as something to get the benefit of academic-originated functional languages with the FFI integratability and large community and ecosystem of more mainstream languages. (I use it for command-line utilities and for writing compiled Python extensions. I'm still on Python for Django and PyQt.)
- throwaway1846 6y agoThis attitude is why I avoid Rust
- ssokolow 6y agoWhat attitude? The "Generally, people who actually know what they're talking about"? I could have phrased it better, but "Rewrite it in Rust" IS a bit of a groaner in the Rust community because of the history of having to do damage control for counter-productively rabid fans who have no idea that Rust isn't magic pixie dust and that rewrites actually take effort. (I've been lurking in /r/rust/ since before Rust 1.0 came out in 2015, so I've seen a lot of that.) The "In that respect, Rust serves"? I'm not the only one who sees Rust as taking the best stuff from functional programming and stopping before the return on investment starts to tank. For example: https://dev.to/yujiri8/why-i-don-t-believe-in-pure-functional-programming-anymore-gin https://dev.to/yujiri8/why-i-don-t-believe-in-pure-functiona...
- avasthe 6y agoRewrite it in rust is not mature reaction from rust community. It is similar to arch linux btw boys you see in Linux communities. And GP is right, you rust folk talk as if sum types are silver bullet. And you people also talk as if rust invented sum types (though you people don't imply it). You folks talk as if cargo is the best package management solution that exist. You folks talk as if web of hundreds of dependencies written by enthusiastic youngsters is not a problem for a language priding itself on safety properties (the attempts like crev don't get the attention they deserve). You folks talk like the memory management overhead of rust is not a problem for creating average CRUD webshit. You folks talk as if rust automatically guides you towards correct programming patterns, when that is out of necessity to facilitate static memory management. The business logic is not at fault here, neither is rust. Some folks in the rust community frequently bring virtue signalling politics into programming language related medium. Rust is a well designed systems language and deserves appreciation for bringing Ada / Cyclone / ATS' good parts as a usable language. But the community is ruining its image. Plaudits to all involved.