logoalt Hacker News

afdbcreid • yesterday at 11:07 PM • 2 replies • view on HN

This is a minor advantage (but is an advantage) and when needed (rarely) you can usually workaround with a different fieldless enum and potentially a proc-macro to autogenerate it.


Replies

xeubie • yesterday at 11:42 PM

It's not at all minor. Sometimes the tag enum already exists. Rust can't build a data enum on top of it: a derive macro only sees its own enum, so it generates a new tag enum instead. Now you have two tag enums to keep in sync by hand. Proc macros are always used to resolve deficiencies in the rust language, and they always lead to greater complexity and longer compile times.