Rust followed the unfortunate example of C++ by using
in Rust, you have to do things like
<> for generics. oh-lang uses [] which is gramatically distinguishable from basic math expressions (x < 5) but it also allows for easier editor movement, since jumping to a matching start/end paren is a simple operation. for comparison, in oh-lang, an array of 32-bit signed integers is #array[#i32], while in Rust it would be Vec<i32> and C++ std::vector<int32_t>.
in Rust, you have to do things like
MyClass::<i32>::MY_FIELD because MyClass<i32>::MY_FIELD would parse as a weird mathematical inequality (??). this is partly due to not being able to distinguish class names from variable names, but mostly due to using <>. it also bugs me that you can't just use MyNotGenericClass.MY_FIELD instead of MyNotGenericClass::MY_FIELD but i guess they wanted to let you know at the callsite that you're using a static variable. these minor syntax deviations are super helpful!
how many of you made it to the end of the post without getting distracted by the giant background gif?? congrats!

Comments
Post a Comment