7 ms·
I've been wanting to learn Rust for a long time, but I'm hit by the curse of Python being the second best at everything. Every time I try to write something in
by StavrosK 8y ago
I've been wanting to learn Rust for a long time, but I'm hit by the curse of Python being the second best at everything. Every time I try to write something in Rust, I think "okay, I can either spend a week learning Rust and writing this, by which point I might lose motivation, or I can have it done in Python in an hour".
Unfortunately, Python always wins, and it's also never not an option, since it runs on everything I care to develop on :(
- Sammi 8y agoSame reason people use Electron for desktop apps. It's just more efficient in development time. And development resources are usually the most expensive part of development.
- thraw0y 8y agoThat's the "somebody else's problem" approach to determining requirements. Performance matters for the end user. They just might not be able to articulate it just like that.
- hombre_fatal 8y agoThe tool that exists today is more useful than the technically superior tool that doesn't exist at all. It's all just trade-offs.
- thraw0y 8y agoAll tradeoffs indeed. Which is why that blanket statement just doesn't work. No one ever implemented a serious compiler/OS/3D game in Ruby.
- Sammi 8y agoAnd no one flew to the moon in a fighter jet. You only use the tool that can actually do the job. OP's point was that Python usually does the job, and using Rust out of the gate might be premature optimization I believe.
- ilovecaching 8y agoIs it second best though? I can write an app in Go in the same amount of time it would take me in Python and it would be an order of magnitude faster, multithreaded, and type checked. Python is really quite slow and error prone if you think about it.
- smogcutter 8y agoYou're missing the point, he could've said brainfuck instead of python and the content would be the same: it's hard to motivate yourself to learn something new when you're already productive in another language and want to get work done.
- WrtCdEvrydy 8y agoI wonder if that will be the next abstraction layer. A programming language that compiles down into target programming languages. Reminds me of Haxe.
- brandonhorst 8y agoThis is already the world with JavaScript. It can be nice as the compiled code is still humanly understandable.
- bluejekyll 8y agoIn some senses, this is what all the JVM languages are, or the WASM languages, or C FFI. You can build compatible layers between any languages, but at the end of the day, most people want to be able to read the libraries and other source code they’re working with. Scala, Kotlin, and Java can all interop with each other, but at the end of the day much of the libraries get rewritten between the languages.
- samatman 8y agoIn addition to the sibling comments, this is also one of the nice things about the Clojure ecosystem: between the JVM and JS, you can target anything with an OS. I would love to see that expand to have an LLVM/C target; the GC complicates that but it could be done.
- dom96 8y agoYou might be more interested in switching to a language that is more similar to Python but has similar benefits to Rust, like Nim. The learning curve won't be as bad and you'll get fast and portable compiled binaries.
- StavrosK 8y agoNim is my second choice, but I really like a lot of things in Rust and would like to learn that, if I can.
- rgoulter 8y agoI thought the reason why "Python is 2nd best" isn't primarily its syntax, but the libraries which are available to use (and big enough communities using them). e.g. with Python you can find libraries (and decent tutorials/examples) for: a small or big web framework, computer-vision, data-science / reproducible science, machine-learning, natural language processing, web-scraping or website testing.
- buster 8y agoYou should still consider learning some rust, because you'll learn some new concepts which might be a win for you anyway (thinking of error handling, options, enum matching, ownership, and what not). Trust me, learning rust zo some degree will make you a better programmer overall!
- StavrosK 8y agoI'm already familiar with some of it and have written various things, but I'm not at the point where I reach for it and am proficient enough at it to prefer it. That's where I'd like to get.
- mlboss 8y agoI think python+pybind11 solves everything. Start with python and move slower parts to C++11 using pybind11. Bonus point: You can use all the existing C/C++ libraries. https://github.com/pybind/pybind11 https://github.com/pybind/pybind11
- aldanor 8y agoIt solves everything if you're happy with C++. Not everyone is, I would personally prefer Rust as it's a better language. (Source: using Python/C++ at work, contributed a lot to pybind11)
- etxm 8y agoSimilar except go and ruby. I’ve tooled around in rust a bit. I like it much more than go, but all-the-ops-things are go, so I feel that’s where I need to put my play time. About 3 months ago I started setting aside an hour every morning before work specifically to only work in go. It was the only way I could learn it because on the job I would just lean on the languages I knew I could develop fast in.
- empath75 8y agoI think some languages you should learn because they make you a better programmer in general, even if you never use it for anything — rust and Haskell, in particular.
- wolco 8y agoI haven't seen a Haskell reference in 6 months. I remember when many weekend submissions were around Haskell.
- a-nikolaev 8y agoYeah, now Rust is the Haskell
- yawaramin 8y agoYou may find OCaml interesting, here's a comprehensive article explaining the benefits relative to Python, from someone who actually ported a significant Python project over to it: http://roscidus.com/blog/blog/2014/02/13/ocaml-what-you-gain/ http://roscidus.com/blog/blog/2014/02/13/ocaml-what-you-gain...
- coder543 8y agoExcept that OCaml is still (for the foreseeable future) single-core only, just like Python, yet it doesn't have the ecosystem Python has. How many good database drivers are there for OCaml? How good are the web frameworks? If I wanted to write a Kafka consumer in OCaml, which battle-tested library would I pick? If I wanted to send an email through {MailGun, SendGrid, Postmarkapp}, are there any integrations that help with that? Even an example of an echo server doesn't look that appealing: https://dev.realworldocaml.org/concurrent-programming.html#improving-the-echo-server https://dev.realworldocaml.org/concurrent-programming.html#i... But, perhaps that is just unfamiliarity on my part. Rust was heavily influenced by some of OCaml's choices, but they chose to make the syntax more familiar and approachable to people coming from the mainstream programming world, although it does have its own quirks. With Go and Rust as options, I'm not sure why someone would pick OCaml in 2019. In 2014, when that article was written, Go and Rust were both much less mature. I hear ReasonML/OCaml could be interesting for frontend work, but frontend is not my specialty. Honestly, as easy as it is to hate on the npm ecosystem, Node.js can run circles around Python in performance, and TypeScript offers a pretty nice type system. If someone just wants a "better Python" for web-related stuff, TypeScript on the backend might be a good option, although I personally lean towards Rust and Go, depending on the project.
- yawaramin 8y agoBeing 'single-core only' is not that much of a problem if you're coming from Python and immediately seeing a huge performance boost compiling to Go-style static native binaries, I think? People immediately jump on the 'single-core' thing with OCaml, but can you explain what exactly it is that you're trying to do with multicore that's not covered by a concurrency library like Lwt or a multi-processing library like Async Parallel? Re: database drivers–which one are you looking for? MSSQL ( https://discuss.ocaml.org/t/ann-first-release-of-mssql/3242 https://discuss.ocaml.org/t/ann-first-release-of-mssql/3242 )? Or Postgres ( http://mmottl.github.io/postgresql-ocaml/ http://mmottl.github.io/postgresql-ocaml/ )? Or SQLite ( https://github.com/mmottl/sqlite3-ocaml https://github.com/mmottl/sqlite3-ocaml )? Re: web frameworks–Eliom ( https://ocsigen.org/eliom/6.6/manual/intro https://ocsigen.org/eliom/6.6/manual/intro ) is one of the most powerful isomorphic web frameworks. Or do you want to spin up a quick JSON API server with Cohttp ( https://github.com/mirage/ocaml-cohttp https://github.com/mirage/ocaml-cohttp )? Or dig into a high-performance, lower-level server ( https://github.com/inhabitedtype/httpaf https://github.com/inhabitedtype/httpaf )? Or you want a Kafka client ( https://opam.ocaml.org/packages/kafka/ https://opam.ocaml.org/packages/kafka/ )? Or maybe you can just take advantage of BuckleScript's high-fidelity approach to transpiling OCaml to JavaScript, and write some bindings to take advantage of basically everything in the npm ecosystem? Sure, not every OCaml library is battle-tested, but I think that's not a good reason to immediately discount it. I didn't tell StavrosK to immediately commit to and rewrite everything in OCaml, I said he might find it interesting. Even with Go, Rust, and TypeScript as options, because: - Not everyone is satisfied with Go's type system or its model of error handling, or its low ceiling for abstraction. - Not everyone is satisfied with Rust's overall newness and potential compiler and library bugs, its lack of GC and the subsequent having to deal with borrow checking, or its slow compile times. - Not everyone is satisfied with trying to model the dynamic complexity of JavaScript in a new, explicitly unsound type system. And it's no secret that the BuckleScript compiler can run rings around tsc for compile speed (not even mentioning the more powerful and battle-tested OCaml language).
- _____bee_____ 8y agoThat's the story of my life :(
- Dowwie 8y agoIt's not that Python always wins but that it wins in the context of a work environment with deadlines and other constraints. If you make time outside of that environment for learning Rust, you can give yourself permission to develop new competencies without losing the productivity argument.
- StavrosK 8y agoIt's a personal argument, I get frustrated and lose motivation when I have an idea I want to create and it takes way too long... Especially when I think "with python, it would have been done by now".
- Dowwie 8y agoBroaden your scorecard. Time to completion is only one measure (although it is a very important one in many scenarios). You can email me if you want to explore Rust for your work or interests. I have a Python background, too, and have open sourced work.
- StavrosK 8y agoThanks, I might! The "time to completion" metric is important for my continued enjoyment, mostly, as I get frustrated otherwise.
- orzig 8y agoAlso the "bus number" consideration - companies are (reasonably) wary to add things to their codebase that only one developer knows how to maintain. Getting a group of devs to commit to >6mo learning Rust could kickstart a real change. There needs to be critical mass.
- Dowwie 8y agoKey man risk is a real challenge. No doubt. Python wasn't always so popular. There was a time when Java was safer for resourcing and Python was risky. What did managers do, if anything, to manage the risk that their sole Python programmer would one day likely leave?