Hacker News new | ask | show | jobs
by gary17the 1473 days ago
Actually, I think Rust is a godsend to startups for the following reasons: 1.) startups rarely have time, expertise or budget for extensive unit tests, mock-up tests, UI-automation tests or paid third-party Q/A services, 2.) software product users these days have a strong tendency never to submit bug reports or work with product support, but instead just leave negative reviews and/or just move on to the competition, 3.) when an MVP actually does get a chance to grow in size and complexity, startups hit the growing pains of efficient problem report accumulation, recognition (troubleshooting, often with a non-technical third-party), prioritization and resolution.

Every programmer who has ever maintained a product of 100,000+ lines-of-code will tell you the same thing: shift as much responsibility as possible on the compiler (and the API consumption boundaries). Fixing code due to a bug with memory management, unexpected mutation, multi-threading, etc. will cost you 10 times the effort required to write that code in the first place.

Just IMHO.

1 comments

What makes Rust better for these attributes than any other statically typed language with immutable data structures?

It sounds like Ocaml would do just as good of a job here.

Ocaml is absolutely playing in similar spaces as rust. I see the tradeoff there as one of runtime performance (Rust) against less syntax / dev effort (Ocaml). If you don't need your code to go fast, Ocaml is probably just fine for you to use. Hell, Jane Street famously does so and has talked in great detail on their podcast and in articles about the many strengths and tradeoffs involved here.
Given how many startups work with python, which is notoriously slow, this is a somewhat ridiculous statement. Ocaml's performance is probably 50ish% of Rust's at worst, which I claim is more than enough for 99% of the problems out there.

Rust's popularity, again I claim, has almost nothing to with its performance. It's more about the much more modern tooling, relatively simplified language (for most parts, though obviously not all) and superior marketing.

It's more like "if you need your code to go extremely fast" though, which is honestly pretty rare in my experience. Ocaml is no slouch and people regularly build great products on much slower languages and that's rarely the limiting factor.
I don't know OCaml, so I cannot compare the two, but, generally speaking, Rust does not require functional programming, or using only immutable data structures, or using cloning, or using copy-on-write semantics (which have to properly handle the reference-type-inside-a-value-type problem), but works through no-copy data ownership transfer, multiple immutable references, or only a single mutable reference to data at a time, all checked across threads at compile-time. Finally, Rust is not garbage-collected, so it can be used in resource-critical environments, such as embedded, metered serverless, Linux kernel drivers, etc. If you're interested, have a look at the "A Firehose of Rust, for busy people who know some C++"[1] video.

[1] https://www.youtube.com/watch?v=FSyfZVuD32Y

Neither does OCaml.

"Unix system programming in OCaml",

https://ocaml.github.io/ocamlunix

Ever heard of MirageOS, and are you aware that DockerDesktop TCP/IP stack uses parts of it?

https://mirage.io/

Ocaml to this day has issues on Windows. Its a phenomenal tool, but adoption is always going to be hampered while the world's dominant desktop OS is a second class citizen for that tool.
Just like most languages that are UNIX first, like Rust.
No, not really. Rust undoubtedly started on *nix, but all Tier 1 platforms are supported equally[1]. To quote from OCaml's main site[2] A gentle reminder that if you do not need Windows binaries, then a more stable option is to use WSL2, ie when on Windows it is better to use OCaml from within a Linux VM.

Ocaml is great, but its Windows support sucks, and that makes adoption hard in a lot of contexts.

[1] https://doc.rust-lang.org/beta/rustc/platform-support.html

[2] https://www.ocaml.org/docs/ocaml-on-windows

Any language that calls themselves systems programming language, on Windows, must have first class support for COM and WinRT, in their various workloads.

Rust support for them is pretty much WIP.

And then there is the whole matter that Windows shops love to ship binary libraries.

There has been a Microsoft supported Rust projection of WinRT for a few years now [1].

[1] https://github.com/microsoft/windows-rs

What languages/platforms do meet this criterion? .NET, C, C++, Python? I know pretty much nothing about Windows system programming, but I wouldn't be surprised if most programming languages really are "Unix first".
Ocaml wouldn't be a bad choice if it were livelier. Few learning resources, and perceived smaller ecosystem create a vicious cycle that hamper its adoption.
What makes Rust better for these attributes than any other statically typed language with immutable data structures?

The ecosystem, even though Rust's ecosystem is still very poor when compared to Java's.