On Thu, May 02, 2013 at 08:25:21PM -0700, Erick Tryzelaar wrote:
> I'm not sure what I think about this, but we could do away with the `as`
> cast operator and replace it with `.to_f32()`. I was already planning on
> adding a ToInt/FromInt for casting to and from enums, so we'll probably
> grow `.to_f32()` and etc anyway. I doubt we could use `.to_f32()` in a
> pattern.

Using a method would disallow casts from appearing in constants, unless
we had some sort of variation on constexpr.

> Or we could change the cast operator. `<expr> : <type>` has some nice
> symmetry with the rest of the syntax. I'm not sure if that would be
> ambiguous though. Scala uses this syntax:

Yes, this is reasonable, though pcwalton wanted to make `:` be *type
ascription* (meaning, say what you expected the type to be, vs
coercing the type).


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

Reply via email to