Hacker News new | past | comments | ask | show | jobs | submit login

Agreed. But maybe my reasoning is different to yours: it creeps me out when I can't tell what the type of something is. Macros fall under that category. Just give me something where values go in and values come out. Something goes in and arbitrary Rust code comes out? That's harder to reason about.

I disagree with the article a bit here:

> I also have the feeling that the “magic” word is just reserved for macros in the Rust community. If you manage to build the same features, but hide them behind the type system, Rust developers will mostly not consider it magic. In many cases I personally prefer well documented macros instead of crazy type system workarounds.

Crazy type system workarounds? Although I prefer the "traditional" approach, the "magic" approach just involves a function that takes a bunch of `FromRequest` arguments which then calls `T::from_request`, that's not all that crazy. The copying is unfortunate, but this isn't some kind of insane type hackery.

Maybe I've just been exposed to too much Haskell monad transformer soup to find this kind of mundane actually understandable stuff "crazy".

Types are the ultimate documentation, over-use of macros gives that up in favour of the macro developer hopefully writing comprehensive documentation, which doesn't always happen. If the compiler isn't making you write enforceably correct documentation (types), you probably won't.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: