Hacker News new | past | comments | ask | show | jobs | submit login

> Perhaps not quite as safe, but at least that they deliver the important parts of that safety without the cost of the learning curve.

Sorry to say this but a lot of unsafe code has been written in Java or C#, putting aside the NPEs and such. In Rust safety isn't only about eliminating SEGFAULTs and buffer overflows, but also preventing data races and most concurrency issues. It's common to add threading to cpu-bound code, without worrying about deadlocks or race conditions.

Rust also allows some very high-level code. Some of my favorite options out there:

- option (std): https://doc.rust-lang.org/std/option/index.html

- serde: https://github.com/serde-rs/serde

- docopt: https://github.com/docopt/docopt.rs

Some more features: generics (traits!), immutability by default, type inference, first-class functions, operator overloading, conversion between related types.




Many applications don't even need to deal with concurrent access though. Or can deal with them in very abstracted way. Sure, in those cases where you're dealing with a lot of concurrency and especially with concurrent access to things, Rust may be a good suggestion, but then you probably fall into the "high performance applications" category I was mentioning.

But again, it's not a generally good solution for CRUD-y business applications, webapps, mobile apps, etc where this sort of work is generally rare if it's present at all.

I definitely don't think it makes Rust seem like an appealing option. Between the limited community library selection, the verbose syntax and the borrow checker's extreme complexity to new users, I wouldn't suggest Rust to say, someone working on a web application currently because they will gain few if any advantages, but suffer many risks.


> I definitely don't think it makes Rust seem like an appealing option. Between the limited community library selection, the verbose syntax and the borrow checker's extreme complexity to new users, I wouldn't suggest Rust to say, someone working on a web application currently because they will gain few if any advantages, but suffer many risks.

You're right that it isn't appealing to those who're looking for fast results and don't worry about maintaining a large codebase for years. For those like me, many of the features Rust provides solve issues we face on a day-to-day basis.

Yes the borrow checker is a pain for a while. Yes the libraries are still immature. Syntax is much more verbose than say Ruby or Python.

But IMO the benefits you reap from strong typing and borrow checking outweigh the steep learning curve. It's not just about memory management, it's also about controlling mutation (because mutation is a hard problem).


I hear you, but most of those benefits are reaped from not just strong, but more importantly static typing alone, which you could gain from simply using C# or Java without the need to commit to the complexity of borrow checking, which only really buys you safety in a few additional cases, but arguably costs you big in development effort, much more so than static typing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: