6 ms·
> which also needs to rely on unsafe code to do anything meaningful with systems programming Rust allows you isolate such instances of unsafe-ness to specific
by nindalf 7y ago
> which also needs to rely on unsafe code to do anything meaningful with systems programming
Rust allows you isolate such instances of unsafe-ness to specific parts of your code base. When you're auditing for safety, you only need to audit those specific parts because everything else is safe by default. For example, the implementation of std::vec::Vec uses unsafe, but it exposes a safe interface. So once you've audited the few hundred lines of std::vec as being safe, you're sure that the millions of lines of code relying on it are transitively safe.
> which doesn't require active internet to work
cargo build, cargo clippy, rustfmt, rust-analyzer, rustc all work without internet. If you want to fetch dependencies from the internet, you need an active connection. If you're in a situation where internet isn't available, you can work around this by writing all the libraries you need. Same with rustup - it needs the internet to download new versions of rustc and cargo.
> you will not have to climb the mountain of learning just to do simple things.
I'm sorry you felt this way. Learning materials are improving all the time and the language is improving too. For example, future combinators were a pain but with the advent of async-await it's easier to write and read code that deals with Futures. Give it another try :)
- dragonsh 7y ago> If you're in a situation where internet isn't available, you can work around this by writing all the libraries you need. Why can’t cargo be simple enough like pypi where all the dependencies are in intranet and private or another way is all the dependencies are in my own simple folder and can update it separately whenever I need rather than relying on an internet connection. Rust cannot match C and it will always need to interface with C code, so in the end it will only be as safe as the C code it is interfacing. I do not understand why to create complex syntax and semantics and difficult to learn language in spite of so much development in compiler world. Like Swift which is similar to Python style syntax. Also Swift is performant and secure enough to provide replacement for objective-c. Hopefully FP (functional programming) becomes more mainstream and take away all this burden of imperative languages like Rust. But being pragmatic understand for hardware C will be there at least for the foreseeable future and Rust and any FP language can only do so much. On a personal level Python made code beautiful by white-spaces, pep-8 and cultivated a habit of trying to write beautiful code. It did not succeed completely in writing every library beautifully because in the end it needs to interface with C libraries where practicality beats purity. Rust copied gofmt and introduced rustfmt. Still Rust has miles to go until it is just able to be as clean as Python for beautiful code and cultivate it as very important habit like Python. It will take Rust may be another 30 years or more to come close to it, given its syntax and reliance on C interface. Any other language I see at present with safety guarantee and as clean as Python is Swift. I like lisp, Haskell and other FP which can achieve a lot with very little code, easier to refactor and maintain in the long run. Rust is just opposite of it. It’s as difficult to learn as Haskell with complex syntax and semantics, but less powerful than C.
- pkolaczk 7y agoSwift is not a competitor for Rust. It may be a competitor for Scala/Kotlin native or Go, but definitely not in the same performance league as Rust or C++. > Hopefully FP (functional programming) becomes more mainstream and take away all this burden of imperative languages like Rust. Pure FP is overrated. It is a nice academic model of computation, but it doesn't reflect the way how hardware works. Hardware is mutable and memory is limited. > It’s as difficult to learn as Haskell with complex syntax and semantics, but less powerful than C. This is a subjective opinion, not a fact. > as clean as Python :D :D :D
- hopia 7y agoWhy would we need to limit our programming language abstractions to how the machines work underneath? Are there some stateful objects running around in the hardware? Just because the abstractions are detached from the hardware doesn't make these design patterns useless.
- yxhuvud 7y agoIt is nice to have a connection between abstractions and hardware, because it makes it easier to reason about performance, which in turn makes it easier to achieve great performance. Now, not everybody actually need great performance, so some distance between hardware and abstraction is ok, but the amount depends on the use case.
- hopia 7y agoWell, I agree, that's why we have both low and high level languages. High level languages, setting you free from the actual constraints of the underlying machine, allow you to define abstractions that can increase productivity greatly - that's their whole point of existence. I mean I don't see people complaining how you don't need to manually manage memory in SQL expressions.
- pkolaczk 7y ago
- pdpi 7y ago> you only need to audit those specific parts because everything else is safe by default This deserves clarification. You only need to audit those specific parts because everything else is safe IFF those parts are safe.