4 ms·
> I really wish Rust had a way to define “template style” It has! It's called proc macro [1]. I'm only half joking. [1] It can generate anything, errors gener
by Ygg2 2y ago
> I really wish Rust had a way to define “template style”
It has! It's called proc macro [1]. I'm only half joking.
[1] It can generate anything, errors generally suck ass in it as much in C++ templates and it feels similarly brittle.
> “Advanced” Rust becomes as inscrutable as C++ template crap.
I think people are abusing traits a bit too much. They are very nifty and often compile to very optimized code.
That said this trait is not an example of such abuse. Having a trait to help with overloading is the most benign form of trait use.
Solution to grandparent's problem is called rust analyzer. It will show you what methods are usable on your variable.
- inferiorhuman 2y agoCertainly it's possible to generate meaningful error messages within proc macros. Most folks don't bother though.
- forrestthewoods 2y agoRust macro hell is even worse than Rust trait spaghetti. I regularly refuse to use crates because they’re macro based and there’s a no macro alternative. But you’re not wrong :)
- tcfhgj 2y agoThere's always a no-macro alternative: expanding the macro by hand. What's macro spaghetti?