5 ms·
Thank you for replying. I do not have any experience with C++ so that's why this could be so confusing to me. I'm a weekend wannabe systems programmer (it's the
by rubiquity 12y ago
Thank you for replying. I do not have any experience with C++ so that's why this could be so confusing to me. I'm a weekend wannabe systems programmer (it's therapy after a long week of Web development) and was attracted to Rust from Ruby because C scares me (this is where Go users laugh that Rust attracted a Rubyist instead of a C++ user). I'll have to research C++ lambdas some more but given the safety, usability and performance gains that you mention this new implementation of closures seems impressive.
- steveklabnik 12y ago> Rust attracted a Rubyist instead of a C++ user I would say that such people may be broader than "Go users," but my "Rust for Rubyists" was one of the very first community tutorials for the language, and Cargo takes a lot of inspiration from Bundler, given that both were written by Yehuda. :) Rust actually has quite a few Ruby/Python people, for exactly what you say: > C scares me This is basically what wycats said about himself in his GoGaruCo talk about Rust: https://www.youtube.com/watch?v=ySW6Yk_DerY https://www.youtube.com/watch?v=ySW6Yk_DerY TL;DR: People migrate from all kinds of places to all kinds of places. :)
- rubiquity 12y agoHah :) I was mostly having fun with the "We created this language for X but actually Y and Z like it instead" aspects of Go and Rust. Thanks for Rust for Rubyists, I remember reading it a while back. I should also thank you for the official Rust docs, which are a lot more robust now.
- Dewie 12y ago> (this is where Go users laugh that Rust attracted a Rubyist instead of a C++ user) That would be the pot calling the kettle black.
- dragonwriter 12y agoC doesn't scare me, but having used both dynamic languages like Ruby/Python and static languages with type inferencing and reasonably robust type systems (e.g., ML-family languages, Haskell), I find C-like languages that require a lot of type ceremony despite having fairly anemic type systems (and this is even more true of the whole C++/C#/Java family of static OO languages) to be quite annoying -- I don't feel like the type system is working for me, but that I'm doing extra work to make things easier for the compiler -- while Rust seems to be in a fairly reasonable place for a statically-typed language.
- TheRubyist 12y agoFeels like we are all preparing for exciting adventure.
- FreeFull 12y agoIt probably helps that Rust's type system is close to what ML-family languages have (the compiler itself was originally developed in OCaml)
- kibwen 12y ago> I'm a weekend wannabe systems programmer > and was attracted to Rust from Ruby because C scares me I myself was attracted from Javascript for the same reason, you're among friends. :) > this is where Go users laugh that Rust attracted a > Rubyist instead of a C++ user I don't think anyone's laughing at anybody. Different languages will appeal to different people, we don't need to begrudge anyone for that! > I'll have to research C++ lambdas some more but given > the safety, usability and performance gains Performance of Rust closures should be the exact same as C++ lambdas. Safety-wise, you get all the usual guarantees of Rust. Usability-wise, the main nicety of Rust closures over C++ lambdas is that Rust doesn't force you to specify a capture clause, and instead infers how to capture all of the closed-over variables based on context. I think that Rust may actually be strictly less powerful than C++ here (as C++ allows you to explicitly specify the capture mode for each and every upvar if you like), but we believe that you'll have all the power you need in practice. Whether or not this turns out to be true will have to be determined by experience.
- mercurial 12y agoWhile it's less important in a language with immutability as default, closures, especially in dynamic longhops, can be a good way of shooting yourself in the foot (eg, capture inside a loop a variable defined outside of it but which is modified at each iteration and wonder why you always get the value set at the last iteration). Capture lists are not always evil.
- bjz_ 12y ago> I'm a weekend wannabe systems programmer (it's therapy after a long week of Web development) I love the fact that systems programming is becoming attractive again! > this is where Go users laugh that Rust attracted a Rubyist instead of a C++ user The members of the Rust community have very diverse backgrounds, so don't feel bad. We have systems programmers, pure FP folks, game devs, folks from the dynamic/web crowd... this is an encouraging thing! You will not be alone in coming from a dynamic language - some of our best contributors are also experienced Python, Ruby or Racket developers.