5 ms·
One thing I'm really hoping to see happen in Rust is more development to make it more "functional," as in suitable for a functional programming style. It's alre
by _redwire 10y ago
One thing I'm really hoping to see happen in Rust is more development to make it more "functional," as in suitable for a functional programming style. It's already so close and, while I don't want to bring up the higher-kinded types discussion, things like stronger support for closures being returned from functions are just not quite there yet for me.
I filled out the survey that was sent around and mentioned some of my concerns about missing crypto-in-Rust code and some of the shortcomings of the documentation. I'm pretty happy I'm not the only one mentioning one or both of those things, because it makes me hopeful that we'll see improvements soon. In particular, regarding docs, I've found it rather difficult to go from reading a type signature and brief explanation of a function/method and being able to actually use it, as a beginner. For example, when I tried to figure out Hyper, it took me a long time to realize I could use pattern matching in my function signatures to capture a mutable reference to something that Hyper was giving me ownership over. I feel silly having missed that, but being a beginner just referencing the Hyper docs, I really struggled.
Does anyone have more information about the crypto situation? In particular, I use ECDSA 384-bit for a lot of the code I write at work and have only been able to find the Ring library, which doesn't seem to feature signing yet. If I could get some high-quality, audited crypto code (or heck, even just some nice Rusty wrappers), I'd be so close to ready to use Rust at my day job and for more personal stuff as well.
- nilved 10y agoI think this ship sailed when Rust removed function purity. Rust is a Scala, not a Haskell.
- _redwire 10y agoSo I'm actually not super familiar with Scala. I do know Haskell a little bit. Could you elaborate on what you think the implications are for Rust's development down the functional route are? I've heard about the potential for support for higher-kinded types, which makes me think there could actually be a strong incentive to be able to do more functional programming in Rust if people started working on monad implementations and such.
- killercup 10y agoThere was a very nice comparison between the type systems of Rust and Haskell a few days back on reddit: https://www.reddit.com/r/rust/comments/4jh8hv/question_about_rust_vs_haskell_type_systems/ https://www.reddit.com/r/rust/comments/4jh8hv/question_about...
- kibwen 10y agoNah, Scala does support higher-kinded types. :P Rust just isn't an especially functional language, though it may seem that way relative to C.
- tatterdemalion 10y agoThe grandparent was probably referring to the fact that Rust allows mutation and side effects, which Scala also does. "Functional" is not a very meaningful term, but Rust has about equivalent support for higher kinded polymorphism as SML or OCaml (in that there is no first class support but another language feature can be used to implement it), which are certainly functional languages. And of course, many lisps are considered functional languages despite not having types at all.
- pjmlp 10y agoHaving started functional programming with Lisp and Caml Light, with Prolog on the side for logic programming, it feels strange this modern notion that Haskell is the be all and end all of FP.
- steveklabnik 10y agoThe "return a closure" part is still awkward, due to lack of boxing by default. You can do what you can do in many functional languages today, there's just some syntactical overhead. There's an RFC that will fix the ergonomics, while also increasing performance by removing the boxing. We're in the process of starting up a docs subteam, and one of the things we're interested in is helping the broader ecosystem get better docs. It's also possible that part of my job writing docs will eventually move towards contributing ecosystem docs, but gotta finish up the official distribution first. Crypto is tough: it's very, very important to get correct. Right now, most projects use wrappers over OpenSSL, but having it all in pure Rust (and maybe some asm where appropriate) is, of course, the dream...
- tatterdemalion 10y agoReturning unboxed closures by way of some form of type abstraction seems like its on the table in the next year. Higher-kinded polymorphism will be a more gradual process.
- zcdziura 10y agoThere are some libsodium bindings that you can use[1]. Otherwise, there's not a ton of "Made In Rust" crypto libraries, though I know some are being written. I myself am working on a prime number generator library[2], which is fairly usable in its current state. 1. https://crates.io/crates/sodiumoxide https://crates.io/crates/sodiumoxide 2. https://crates.io/crates/pumpkin https://crates.io/crates/pumpkin