I am baffled by how much trouble I’m having at writing #rust at a decent clip. #Golang I felt pretty good at after a few months, same with #Python and #PHP. Meanwhile I’ve been trying to write anything useful in Rust for months and it’s so incredibly slow going.

I’m shocked people are enthusiastic about adopting this for their jobs. If I had a specific part of an app that needed more speed, absolutely. But as a general purpose language? I’m not seeing it yet.

I’ll keep ramming my head against it but have not enjoyed myself thus far. If writing a proof of concept in python takes me 4 hours, rewriting that in rust clocks in easily at 12-16 hours.

@matdevdug same here

@iblancasa @matdevdug Learning Rust is an investment that takes time. Look at the results from Google about adopting Rust: https://opensource.googleblog.com/2023/06/rust-fact-vs-fiction-5-insights-from-googles-rust-journey-2022.html?m=1

I would love to help if you have any specific questions 

Rust fact vs. fiction: 5 Insights from Google's Rust journey in 2022

Wondering about Rust? We're addressing rumors and providing insight gained from years of early adoption of Rust here at Google.

Google Open Source Blog
@matdevdug @mo8it thank you!
I’m studying Rust and find it really interesting but for specific use cases. Not for the day to day… Python is easier for it 🤷🏻‍♂️
@matdevdug I'm reasonably good at #rust but I still don't get why people try to push it as a high level language. Rust is infinitely better than C an C++ but I wouldn't put it as an alternative to #golang or #python in places where they are a good fit. Rust has some good static safety features, but so it doesn't have some. For instance, the type system in Python or TypeScript is a lot more powerful.

@orsinium "The type system of Python is much more powerful"

Is this an objective conclusion that you can explain?

Python's "type system" is an optional very late after thought to improve the language on a fragile base.

@mo8it Sure I can. In Python, you have literal types, function overload, protocols for attributes, annotations for descriptors, and lots of other things. And TS can do even more with dependent types, there are even examples of JSON parser and Assembler on type system. But in Rust, for example, you can't say that a function returns or accepts only a specific member of an enum. Having type system independent from the runtime types naturally gives a certain degree of freedom.
@orsinium Usually, you use the type state pattern for that in Rust. But I agree that enum variants as a full type could be a nice improvement.

@orsinium @mo8it i think you're not talking about how strong or not a type system is, but how strict. Rusts type system is very strict, and pythons is the opposite. That means you can do things in python which are a really bad idea but it just lets you do it.

In Rust this is not the case - it restricts you in many ways like not allowing overloads.

by the way, python doesn't have overloading either. a function can accept different types due to the weak type system, but that's not overloading.

@laund @mo8it No, I am talking about the power of the type system. In case of Python and TS, I mean the types that type checkers check, not the runtime.

And by overload I also mean the one you do for static type checking:
https://docs.python.org/3/library/typing.html#typing.overload

On a side note, if you want to try the next level of type safety, take a peak at #Idris. It builds on dependent types, and that's something beyond any of the type checkers I mentioned earlier (TS has basic dependent types, though).

typing — Support for type hints

Source code: Lib/typing.py This module provides runtime support for type hints. Consider the function below: The function surface_area_of_cube takes an argument expected to be an instance of float,...

Python documentation

@orsinium @mo8it a type system is only powerful if it can meaningfully help assure the programmer or compiler about things. Pythons type checkers are better than nothing but far from ideal. They do not inform the language about anything (in most cases, yes i know mypyc exists) and they only slightly assure me as a programmer that I'm not misusing things.

Rust strikes a great balance here, having a strict type system which assures me a lot, while not making types their own programming language.

@matdevdug If you don‘t need rust for your jobs or projects, I‘d say it’s perfectly fine to stop learning it. Especially if you are not interested in the language itself.

I want to learn rust for parts of my software where dev speed is not as important as longevity, execution speed, and correctness. If new features are more valuable maybe another language is just the better fit.

@lu3tz I mostly wanted to learn it because friends have had great results. I’m gonna keep chugging away.

@matdevdug
It took me a few years of occasional effort to get proficient at Rust; it's one of the hardest languages I ever learned.

I greatly enjoy it now. I got better at staying on a smooth path most of the time. There's something addicting about making it all fit together. I have confidence in big refactors.

Have I just climbed that hill and now want to convince myself it was worth it? In part, but it also opened many areas of software previously closed, where I need that performance.

@matdevdug
I could write C and C++ already, at least years ago (C++ has changed a lot since then). But Rust gives me confidence and enjoyment where those languages do not. The empowering feeling is in a strange way similar to what I felt at my discovery of Python 25 years ago, but for the low level control high performance domain.

Is Rust a good general purpose language? There's something to say for the tradeoff: more effort to learn but more maintainable architecture and better efficiency.

@matdevdug
writing serious, robust and 'production ready' code does take more time (which is regained during maintance phase).

@matdevdug This is how I feel about c++. I suspect Rust is a great choice if you're writing in a domain where you have to break the memory abstraction, but if you're not, using languages that'll handle it for you is much faster.

Rust is great compared to c++ (and in that problem domain, great relative to languages where auto garbage collection can't be switched off and you can't trust a gc cycle won't run your day or the footprint of having a gc won't make it impossible to run your program on a given hardware target).

@matdevdug Rust really shines in situations where you need both speed and maintainability. If you need to pretty regularly rewrite portions of a code base refactoring is super easy.

Your time estimate feels about right for my experience as well, but where you'll see value is later refactoring.

If you're not likely to refactor or make regular changes, python is definitely going to be more time effective long term. Python really shines with its libraries and speed of writing.

@matdevdug that was certainly my experience when I attempted doing Advent of Code last year as a Rust-learning exercise. I'm still thinking of doing a mini Rust project but haven't decided on anything yet - I can recognise that most of my ideas would just be huge time/energy sinks, so haven't taken any of them on 😅
Hope it gets easier soon!

@matdevdug #Rust is hard. Some programming domains are less-hard than others in Rust. You also trade code-writing speed for correctness -- I'd *much* rather code slowly to reduce debugging time.

What helped me was that my first couple of Rust projects were smaller, self-written domain-specific libraries that I was porting.

Nowadays, if I want a good speed-difficulty tradeoff, I write #Kotlin.

@matdevdug Yes. There's a lot of talk out there about Rust being easy to learn. I've been involved in programming for over 40 years and am proficient in C and C++ but I found learning Rust non-trivial. I guess it's a case of "keep at it" and you pick-up more of the little nuances as you go along. Gradually something newly learned serves to explain an earlier stumbling block and momentum builds.
@matdevdug I also came from GC languages (Java, Python, Lua). What helped was learning about Box, Rc, Arc and clone.
Rust wants to be efficient in the default case. So everything is making you share references by default and will trigger the borrow checker. Not like in Python where everything is a Rc ref by default.
So if you want to write code fast you have to use owned values, clone and Rc a lot. Later you can improve for performance when necessary.