by _random_ · 12y ago · 0 comments
However, you can make custom attributes expand to arbitrary generated code via the macro system, allowing something similar. This is how we do fast JSON serialization, for instance: the #[deriving(Encodable)] attribute expands to optimized, type-specialized code at compile time, avoiding costly reflection at runtime. (Note that this is an experimental feature, so it may change post 1.0.)