5 ms·
I read this 3-4 times and realized why people stick to python though
by antman 4y ago
I read this 3-4 times and realized why people stick to python though
- Yoric 4y agoCertainly, many applications don't need this kind of complexity. But if you're working on one who does, you're typically glad to use Rust :)
- nequo 4y agoYeah. Speed and memory efficiency don’t come for free. Use Rust when you benefit enough to compensate for the cost of grokking the plumbing.
- atemerev 4y agoThere are many simpler languages with speed and memory efficiency (Nim, Crystal and the like). Rust somehow became even more complex than C++; what an achievement (not).
- nequo 4y agoTwo things that might help Rust a lot despite the complexity are the tooling and the ecosystem. Cargo is good, the compiler is extremely helpful, and there are a lot of crates to build on for all sorts of tasks. For example, if I need to use simulated annealing to solve an optimization problem, there already exist libraries that implement that algorithm well.[1] Unfortunately, the Haskell library for this seems to be unmaintained[2] and so does the OCaml library that I can find.[3] Similarly, Agda, Idris, and Lean 4 all seem like great languages. But not having libraries for one's tasks is a big obstacle to adoption. Nim looks very promising. (Surprisingly so to me.) Hopefully they will succeed at gaining wider recognition and growing a healthy ecosystem. [1] E.g., https://github.com/argmin-rs/argmin https://github.com/argmin-rs/argmin [2] https://hackage.haskell.org/package/hmatrix-gsl-0.19.0.1 https://hackage.haskell.org/package/hmatrix-gsl-0.19.0.1 was released in 2018. (Although there are newer commits in the GitHub repo, https://github.com/haskell-numerics/hmatrix https://github.com/haskell-numerics/hmatrix. Not too sure what is going on.) [3] https://github.com/khigia/ocaml-anneal https://github.com/khigia/ocaml-anneal
- chowells 4y agoFwiw, hmatrix-gsl works trivially and painlessly. Why does a working library need changes?
- nequo 4y agoGood to know that hmatrix-gsl works too. In this case, I went down the Rust route instead of the Haskell one. I use Haskell too, just not for simulated annealing. My main domain is scientific computing and I get nervous about the prospect of not being able to run my code 5 or 10 years down the road (somewhat above the typical lifespan of a project that ends up published in my discipline). GHC gets updates that sometimes require library maintainers to update their libraries. Here is a list of a few: https://github.com/fumieval/Haskell-breaking-changes https://github.com/fumieval/Haskell-breaking-changes Rust promises no breaking changes in the stable part of the language. Hopefully this promise will hold up.
- ben-schaaf 4y ago> Rust somehow became even more complex than C++ I use C++ professionally and the small subset of it that I've learnt is already way more complicated than rust.
- Gigachad 4y agoArc is a low level tool for writing multi threaded programs. If it scares you back to Python you could also just write single threaded Rust.
- friedman23 4y agoThe complexity exposed by Rust is overwhelming for people that haven't done any low level programming. It's not just lifetimes, a basic Rust function can expose the ideas of exclusive and non-exclusive ownership, traits, generics with and without trait bounds, algebraic data types, closures, closures that move, async, async blocks, smart pointers, macros, trait objects, etc etc. There is absolutely a learning curve and it makes me understand why Golang is the way it is. The language authors of Golang saw the business needs of Google, realized that they need to get domain experts that are not programming savants to write code and created a language that would allow the largest number of non programmer domain experts be productive coders. That being said, the Golang developers went too far and let too many of their biased ideas for what is "simple" infect the language. In what way is it simple for a language to not be null safe. I have a bunch of other complaints too. But anyway, I don't think Rust is going to be a revolution in writing software unfortunately. I don't think enough people will be able to learn it for companies to be able to hire for Rust positions.
- shortcake27 4y agoRust keeps getting hyped so I thought I should give it a go. I’ve been writing JS/TS, Ruby, PHP, Python for 10+ years. It was a real struggle, and I wasn’t enjoying it at all. “Programming Savant” is a great way to put it because all the people I know who like Rust also happen to be the smartest engineers. In the end I gave up because I wasn’t getting any value. I was also trying to find a Rails equivalent, tried Actix and I didn’t like that either.
- shepherdjerred 4y agoRust is a good replacement for C/C++. It's not a good replacement for the languages you listed.
- satvikpendem 4y agoDisagree, I have a web server in Actix that I would have written in TypeScript and Node, or Python and Django, or Ruby and Rails, and the Rust version is similarly high level but far faster and more efficient. I recommend people read Zero To Rust In Production if they want to build a web API in Rust. https://zero2prod.com https://zero2prod.com
- Shish2k 4y agoIt’s basically as complicated as “If a subclass and a parent class both define a `bar()` method, and you have an instance of the subclass named `foo`, calling `foo.bar()` will call the subclass version” I actually find that simpler than some of the spaghettis you can create with Python’s multiple inheritance :P
- anderskaseorg 4y agoBecause, what, Python doesn’t have any language details related to method lookup that might require a sentence or two of technical explanation? __getattr__, __getattribute__, __get__, base classes, metaclasses, __mro__, __mro_entries__, __dict__, __slots__, __call__, bound and unbound methods—none of this has ever confused someone looking at it for the first 3–4 times? I assume you’re going to reply that you don’t need to think about all this when writing most Python. And that’s true of most Rust too. Don’t get me wrong, Rust does have some unique complexity that Rust programmers need to learn in exchange for its unique safety guarantees—but method lookup isn’t where the complexity is.
- vvillena 4y agoThose types are wrappers that keep a reference to some data. In any language, it's common to encounter issues when people confuse copying the underlying data with copying just the container around the data and keep pointing to the same thing. In Python, a list of lists has the same behavior. l = [ [ 1, 2, 3 ] ] l2 = l.copy() l[0][0] = 99 print(l) // [[99,2,3]] print(l2) // [[99,2,3]]
- itronitron 4y agothere was similar confusion regarding pass by reference and pass by value when Java first came out.
- spoiler 4y agoPython is not immune to this (for different reasons though)... If you want to be snide online, make sure you're correct first :)
- waiseristy 4y agoRE: Any article about the GIL
- antonvs 4y agoPython is not even remotely an option for the sorts of programs Rust is intended for.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- dang 4y ago"Eschew flamebait. Avoid generic tangents." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html We detached this subthread from https://news.ycombinator.com/item?id=34429403 https://news.ycombinator.com/item?id=34429403.