On 13-08-23 09:49 AM, Oren Ben-Kiki wrote:
> Yes, Rust has a `deriving` attribute one can attach to types (for stuff
> like `Eq`, `Ord`, etc.).
> 
> That said, as long as the vtable is already there, I think Rust should
> do what Haskell is moving to (automatically `derive Typeable`) - that
> is, automatically place the necessary data in the vtable.

Every type descriptor has a visitor-glue method written into it, which
provides typeable-like structural reflection (std::reflect) on types,
but not (presently) efficient type-equality. We'd need to augment it
slightly to provide that, but I think it'd be possible. This code is
used in fmt! for example to support printing arbitrary values (std::repr).

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to