I’m using a macro to build structs that are suitable for diesel and prevent duplication of entity struct (containing the id, i.e. the one-to-one map to the table structure) and normal struct (without the id, i.e. representing a real-world object). Why it’s better to have separate type for the real-world object is described here:
So the original idea of the macro came from here:
My approach of doing things while learning the language is that I always start implementing things in the smallest scope (i.e. …
If you program in Python you can write easily programs that have a very bad error handling, and you will probably notice it during runtime, when the errors actually happen. It can be a nightmare.
In Rust you’re forced by the compiler to handle the errors, just like exceptions in Java, but in a very different way.
The main problem with more complicated error handling and static types is that you can use a lot of different libraries with their special error types, and it’s a bit tedious to have a match case for all of them. …
Although I understand the borrowing concept, it’s still hard to train my brain, that passing ‘&var’ to a function doesn’t mean that I pass the address to a function, and it won’t be automatically mutable this way.
Also if I pass a ‘var’ doesn’t mean that the variable will be copied.
Well, too much time in pure C programming… Maybe if they didn’t reuse the same characters for different concepts, or I just have to be more flexible? :-)
I’ve started this blog to note my efforts on learning a new programming language. I’m a life-long pupil currently at my 44th year of learning the world. I’m physically located in Hungary, while I feel myself mentally living around the planet.
Before my current job I was working as Java developer for 2 years. Although I’ve always had interest in learning new software development technologies, I’ve been working as an embedded software developer since 2003, mainly programming in C on bare metal.
I think I was the first who used Python at our company for writing some software tools, but…