Rust has Enums and Traits which are Sum Types and ADTs in other languages. They are really nice to use because Rust forces you to account for all the possibilities when you match against an Enum. Also Traits allow for a really nice way to extend and use familiar interfaces in new ways. Traits are also used for overloading operators like + or - on custom defined types. Rust's Iterator trait is really interesting and is used in a lot of different places.
Ruby is my main love, so blocks are a really wonderful feature that are similar to lambdas. They are so easy to use and allow the nice functional stuff like map, reduce, etc. Also Ruby's metaprogramming syntax is a little too easy, but is also super powerful when you need it.
I like that you can do systems level programming using high-level programming abstractions. And its borrow checker, I'd love to learn the theory behind it someday.
The borrow checker is actually surprisingly simple, although the consequences of having it are complex. Basically you can either borrow immutably, borrow mutably, or own data. An immutable borrow can be shared in many contexts at a time, a mutable borrow can only be shared with one context at a time, and ownership means you're giving up that data to another context.
I've been working on a raytracer/pathtracer. Although I'm not very good at the trig yet. I also wrote a Piet language interpreter.
Interesting that you're working on a raytracer. That is the project I plan to do when I decide to learn Rust.
I started implementing one many years ago in C but never completed it. Then, I did one in Python to relearn the concepts but it's obviously slow as hell. Rust would be ideal.
Rust has Enums and Traits which are Sum Types and ADTs in other languages. They are really nice to use because Rust forces you to account for all the possibilities when you match against an Enum. Also Traits allow for a really nice way to extend and use familiar interfaces in new ways. Traits are also used for overloading operators like
+
or-
on custom defined types. Rust'sIterator
trait is really interesting and is used in a lot of different places.Ruby is my main love, so blocks are a really wonderful feature that are similar to lambdas. They are so easy to use and allow the nice functional stuff like
map
,reduce
, etc. Also Ruby's metaprogramming syntax is a little too easy, but is also super powerful when you need it.Yeah, Rust is really nice.
I like that you can do systems level programming using high-level programming abstractions. And its borrow checker, I'd love to learn the theory behind it someday.
What are you working on with Rust?
The borrow checker is actually surprisingly simple, although the consequences of having it are complex. Basically you can either borrow immutably, borrow mutably, or own data. An immutable borrow can be shared in many contexts at a time, a mutable borrow can only be shared with one context at a time, and ownership means you're giving up that data to another context.
I've been working on a raytracer/pathtracer. Although I'm not very good at the trig yet. I also wrote a Piet language interpreter.
Interesting that you're working on a raytracer. That is the project I plan to do when I decide to learn Rust.
I started implementing one many years ago in C but never completed it. Then, I did one in Python to relearn the concepts but it's obviously slow as hell. Rust would be ideal.
All the best with your raytracer.
Thanks! You too.