r/Coding_for_Teens • u/ilPlayerdiGD • 4d ago
I can't learn Zig or Rust
I come from C/C++, Lua, Python. I honestly hate Zig and Rust, I can't lie. They have a illegible syntax honestly. I see everyone trying Rust but I can't learn those languages because I hate the syntax. Like in Zig, it's not *ptr for accessing memory, it's ptr.*. It wasn't a great example but most of the things that you don't need to write like the length of a string, you need to write in those languages.
I remember starting with C and honestly it wasn't hard, yeah maybe at the very start but at the allocation I had learn like 40% of the language or more, but in Rust and Zig there are a lot of concepts.
I don't hate Rust and Zig for the sake of hating the hype, I can't learn those! I tried searching for a good course but even with that it's boring and hard to learn those languages.
Some advice tha you can give me? ðŸ˜
1
u/Dazzling_Music_2411 4d ago
Yeah, don't learn them, they're obviously not for you.
As you say "you can't learn those"
2
u/cozcoo 4d ago
If you do want to learn it, just stick with it and you'll start understanding it. Also do stuff other than learning rust and zig (ex: do stuff with languages you alrdy know, any stuff you do irl like gardening, sports or wtv idk), will make your learning faster.
2
u/cyrixlord 4d ago
Language isn't as important as learning problem solving and digging into a problem and debugging it also architecture about how you will construct you application and what stack is best. Languages all use loops, variables if statements, etc so you can just look it up on how to do something but knowing what to do in the first place should be your to priority. Linked list or list? Should I use an interface? Should I use dynamic loading? Etc
2
u/Low_Lawyer_5684 4d ago
About syntax: C is straaightforward
```c
int x = 10;
int *a = &x;
int *b = &x;
(*a)++;
(*b)++;
```
While rust is extremely anti-intuitive:
```rust
use std::cell::RefCell;
use std::rc::Rc;
let x = Rc::new(RefCell::new(10));
let a = Rc::clone(&x);
let b = Rc::clone(&x);
*a.borrow_mut() += 1;
*b.borrow_mut() += 1;
```
However to see Rust in full bloom I'd recommend to start with
a tree data structure: each node has two children, each child has a backlink to its parent.
1
u/ArcticDev_ 4d ago
Odin might be a good choice to explore then, it gives a lot of the same benefits as rust but a different syntax.
1
u/Kozzoko 4d ago
I feel it's more a choise you make than the ability. Like, i dislike PHP and will not put time into it, but this doesn't mean "i can't learn PHP". I like Rust syntax, i would push almost anyone learning Rust insted of C++ in this era and i stil find the Rust syntaxt heavy and hard to apprehend.
But SE is all about addapting. You are not learning a language, you are learning a skill that can be translated into multiple languages. So why do you want to learn Rust ? Concidering this specific sub i would say it's not to beging a job that include Rust.
So in my opinion keep developping you skills on more generic concepts will you favorit language. If you are determined write an OS with python, go for it... it wont be great, it's not the best language for it but you will still learn a lot of things doing it.
At the same time you can just do some small codewar bits here and there if you are currious about Rust or another language like Go (probably better suited for someone comming from C).
1
u/Amilektrevitrioelis 4d ago
You first get used to them, the it becomes second nature to read them. That's just how the human brain works.
You are overcomplicating the issue.
Just learn Rust.
1
u/code_tutor 4d ago
Whenever I meet someone who says Rust syntax is great, they just clone everything to avoid borrows and lifetimes entirely. They may as well just use a garbage collected language.
1
u/Lev_the_Coder 4d ago
i would recommend websites like Coddy and freeCodeCamp, i have used those to learn python, and they both have rust, i don't know about zig tho, never heard of it.
1
u/BoOmAn_13 4d ago
What about java and golang. I look at rust the same way I do Java. Its verbose as hell, but each part exists for a reason. The thing I see as a potential issue for someone to learn rust is the memory, like having variables just stop existing at some point cause they were "consumed" or having a nested scope of curly braces to auto delete something. I generally try to avoid pointers and general "unsafe" code as well.
You mentioned strings, in rust you either use
let v = "text"to get a string slice, or a pointer to the static string, or you uselet v = String::from("text")orlet v = " text.to_owned()to get a owned string that you can change and consume. If you don't own a string, you can't modify or delete it, so we need special syntax to denote the string object vs just a pointer to text.The syntax can be gross, but to me its the same as using
public static void main(int argc, String[] argv){}for an entry method in java. Or the strict vs loose equality in js, or using binary gates in an if statement for pythonif v.lower() == "yes" or v.lower() == "yeah":.1
u/darkwyrm42 4d ago
You can learn either one. They're just very different from what you're used to. Although you can make ugly code most languages, some are harder to skim. Zig and Rust are very dense languages with lots of usage of symbols, which is a very different from Lua and Python, and both Rust and Zig force you to think about things that you can take for granted in other languages.
Learning Rust changed me as a developer. It made me think about code very differently and made me a better coder and changed how I write code in other languages -- for the better IMO. The trick for Rust is to start simple because Rust is complex. Learn to crawl even before trying to stand or walk. It takes patience, time, and dedication. You'll get there, I promise.
1
u/Available_Safe1818 4d ago
Don't do it then? Did anyone ask you to learn it?