Interesting - I see std::intrinsics::unstable::get_tydescr<T> -> *TyDescr...

Two questions:

- Can this be used for a quick type equality check (same pointer <=> same
type)?

- How can one invoke `get_tydescr<int>()` or `get_tydescr<T>` (when `T` is
a type parameter of the current function)? I get a syntax error on the
`int` or `T`.


On Fri, Aug 23, 2013 at 8:50 PM, Graydon Hoare <[email protected]> wrote:

> 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