lainchan / λ

Project ideas for learning Rust

vvv_vvv · 2023-09-11 03:38
What would be the best project to get familiar with rust? I don't like learning languages by tutorials and I prefer just building something in it (like I did with Golang). I was thinking of writing a simple GUI for pacman, are there are any other cool ideas?
Zuse · 2023-09-11 04:42
any project will naturally raise questions, which will be answered by doing research to execute the project. This should not be a thread in itself, there is a beginner questions thread for this exact purpose.
↑ · 2023-09-11 11:04
I'd recommend something that will force you to deal with smart pointers like RefCell, rc, arc, etc.
Six · 2023-09-11 23:10
>>37093 I don't think using Rust just to make a GUI wrapper for an existing language is a great idea. This is precisely the kind of thing that the language and its ecosystem are frankly not that great at. Despite Rust's marketing as a "systems language", it also has significant problems for systems development, comparable to the problems that C++ has. C, to this day, appears to be the best systems language. I personally think Rust is an excellent language for developing compute-heavy applications though, especially scientific applications. The features like functional languages are great for expressing scientific or mathematical formalism, and you still get the speed of the mainstay languages in that department, C/C++ and Fortran.
Unidentified · 2023-09-14 01:09
Fun little thing, have a project of some algorithm or something you value, and recreate it in as many languages as possible.
Just another Random Lainon · 2023-09-15 10:39
>>37098 I learned rust by writing a lisp runtime in it. Id link to it but I already posted about it in the LISP general. My first approach leveraged a lof of Rc, RefCell, etc. if you snoop around the repo you can actually see the functional state of that design before I ground up reimplemented everything. I would recommend actually staying as far away from INTERIOR MUTABILITY as possible. It is an antipattern in rust code, and quite frankly an antipattern everywhere. If you find yourself using Rc and RefCell I think it is a sign that you are architecting a C++ app with Rust code.... or worse. My opinion is that when learning Rust one should focus on learning all the wonderful ins and outs of Result, Optional, and Rust's very cool enum system. These are Rust features that led me to write more idiomatic, safe, and elegant code, and also bolstered the effectiveness of the rest of control flow.