5 ms·
> The language may be complex Compared to what? Edit: This was not meant as a slight, I quite like Rust's comapritive simplicity when held up to other non-GC
by santaclaus 10y ago
> The language may be complex
Compared to what?
Edit: This was not meant as a slight, I quite like Rust's comapritive simplicity when held up to other non-GC 'systems' languages.
- duaneb 10y agoTo answer you seriously—I think a great contrast would be the simplicity of Go. The GC and type system are both the opposite of providing complexity to the user; they provide the only way to get anything done, and it's easy to keep in your head. For the record, I prefer rust.
- ffggvv 10y agoI would like to switch from go to rust. But rust's standard library isn't as mature as that of go. Do you think there are compatible crates to packages from go's standard library. I need * json/gzip/etc. * string manipulation * good unicode support (normalization, etc.) not much actually. And one important question: which one do you think is best for large projects? Both were built to deal with difficulties rising from large projects but took two opposite directions...
- clarkmoody 10y agoRust has a nice standard library, but much nice functionality comes from external crates. If you haven't yet, you should check out the Cargo tutorial[1], which is an intro to the package management and build system. I have used a JSON library, which worked well out of the box. I'm sure there are others up there for your other bullets. I will say that all strings in Rust are Unicode, so the support is there. Edit to your question about large projects: I think Rust's type system will prove to be a long-term benefit for large projects. The type system / borrow checker combination is the secret sauce of Rust. [1] http://doc.crates.io/index.html http://doc.crates.io/index.html
- steveklabnik 10y ago* https://crates.io/crates/serde_json [1] * https://crates.io/crates/flate2 * https://crates.io/crates/unicode-normalization "String manipulation" is a bit broad, but Rust's string types are already pretty rich. [1]: small caveat here: this crate works on stable, but is more convenient on nightly. (Think "right now it's "go generate" but eventually it will be easier than that). We're close to stabilizing the stuff that it needs to be convenient on stable, but the earliest that could land in stable is Dec 22. (I just did this math yesterday.)
- timClicks 10y agoThe Rust stdlib is indeed quite a bit slimmer, largely by design AFAICT. String manipulation and Unicode sopport are very much there. Serde (https://serde.rs/ https://serde.rs/) is probably what you're looking for for serialization tasks.
- pcwalton 10y ago> But rust's standard library isn't as mature as that of go. I'm not really sure that's true. Rust probably has a smaller standard library overall, but there are things that it has that Go doesn't: B-trees, native OS string encodings, functional tools, round(), etc. The bigger point is that the crates.io ecosystem readily has support for everything you're asking for, and it's much easier to pull in third-party dependencies in Rust.
- Gankro 10y agoI am fairly certain I successfully got binary trees deleted from the standard library. If you monsters added it back, so help me god... (BTrees, on the other hand, thrive)
- pcwalton 10y agoSorry about that. Corrected myself.
- deleted 10y ago[deleted]
- burntsushi 10y agoFWIW, in my opinion, the biggest thing that Rust has in `std` that Go doesn't is its iterator API. (I think you might have meant this by "functional tools," but just wanted to clarify.)
- kibwen 10y agoIf by JSON you need serialization, then I'd recommend Serde: https://crates.io/crates/serde https://crates.io/crates/serde (which works on stable Rust but has a nicer interface on nightly; this nicer interface should be available on stable by early next year at the latest) For Unicode support, here are crates for normalization https://crates.io/crates/unicode-normalization https://crates.io/crates/unicode-normalization and segmentation (working with grapheme clusters and so on) https://crates.io/crates/unicode-segmentation https://crates.io/crates/unicode-segmentation Re: "string manipulation" what do you need? Rust has a rich set of methods built in to its two native string types, (e.g. left-padding https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.pad https://doc.rust-lang.org/std/fmt/struct.Formatter.html#meth... :P ), and we're open to adding more if there's demand for them.
- Thaxll 10y agoEverything besides C and C++.
- sidlls 10y agoC is considerably less complex than either Rust or C++.
- pjmlp 10y agoBy those that use a single compiler, on a single OS and never had to deal with UB bugs.
- sidlls 10y agoI regularly have used more than one compiler (Borland, cc, early Microsoft, and one or two other proprietary ones for developing drivers for embedded optics controllers), programmed for more than one OS (Linux, a RTOS flavor of Linux, MS, Apple, AIX), and have seen my fair share of UB issues. What you're referring to (programs and behaviors) is not what I was referring to (language details).
- tatterdemalion 10y agoI don't understand how implementation-defined and undefined behavior are not a part of the language semantics. They're specified in the language standard, and they determine how the program code will be compiled. They're clearly part of the language. The pretense that C is a simple language is equivocation, in my opinion.
- sidlls 10y agoHmmm, that's a fair point, since "which C" applies, but I think that's a deficiency in the standard and larger in scope than the point I intended.
- 10y ago
- nickpsecurity 10y agoModula-3 with a concurrent, low-latency GC + static analysis on anything declared unsafe. That's first example that comes to mind. It nicely balanced safety, compilation speed, productivity, and runtime performance. SPIN OS was written in it that leveraged type-safe linking + its safety to pull user add-ons straight into the kernel without crashes. CVSup for FreeBSD was originally done in it as well with development experience so good vs C++ that author didn't want to give it up. https://en.wikipedia.org/wiki/Modula-3 https://en.wikipedia.org/wiki/Modula-3 So, that's my baseline if we're excluding functional programming elements. Maybe that with Design-by-Contract and SCOOP from Eiffel. I'd add borrow checker from Rust for unsafe sections as an option. Past that, you've already knocked out vast majority of issues while retaining rapid development. If functional programming, I'd start with a PreScheme (C replacement), bring it closer to Racket on static or dynamic side for power, build in safety analysis, and sugar coat it with nice syntax + standard library. Julia language did something similar to that approach with femtolisp at the core. Also easy to read and learn for a language so powerful. I currently recommend Rust over most C alternatives due to the attributes in its motto plus strong community (most important) around it. The simpler alternatives in this niche got little traction for various reasons that are more social or economic than technical. So, if you're jumping on a wave, might as well pick the one that's safe and fast by default.
- sidlls 10y agoI think the rust compiler's enforcement of borrowing and explicit mutability make writing non-trivial Rust code as complicated as writing the same program with code that has equivalent safety (which isn't enforced) in C++. The biggest issues I've seen lie at the safe/unsafe boundary. Things that are trivial to write without safety guarantees in C++ become more verbose (at least) in Rust.
- pjmlp 10y agoBut that is a common feature to Ada, Modula-3, Oberon derivatives, even Frama-C. On one hand we need to still be able to do low-level stuff on "as needed" basis, but on the other hand it needs to be hard and explicit so that route is only taken as least resort and very easy to track down, even without help from tools.
- allengeorge 10y agoIt's...not an easy language. Not unapproachable by any stretch, but it's got surface area. The thing that (currently) trips me up the most is figuring out when when I've to dereference something, and why, when I've to pass a reference to something and why, etc. Sometimes I do end up with a touch of operator soup.
- tatterdemalion 10y ago> The thing that (currently) trips me up the most is figuring out when when I've to dereference something, and why, when I've to pass a reference to something and why, etc. Sometimes I do end up with a touch of operator soup. This is a very common experience! One of the goals this year is to ease this painpoint.