Got it, thanks. I guess that the TyDescr could be extended in the future to
support type equality and other things. In the meanwhile, in my case I'll
have the user manually annotate the Dynamic with an (interned) string
containing the type name, and pray people don't mess it up.

Thanks!


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

> On 13-08-23 11:08 AM, Oren Ben-Kiki wrote:
> > 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)?
>
> No, as I said, it does not support efficient type-equality. We don't
> normalize all types. You should be able to count on one-way equality at
> the moment (same pointer => same type) but not vice-versa.
>
> > - 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`.
>
> get_tydesc::<T>(). This is the foo<> vs foo::<> syntax papercut. Gets
> everyone, sorry. It's the price of using <> for type parameters rather
> than []. We need a better error message for it.
>
> -Graydon
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to