On Mon, Oct 29, 2012 at 2:52 PM, Graydon Hoare <gray...@mozilla.com> wrote: > On 12-10-23 8:10 AM, Patrick Walton wrote: > >> Note that casts are considered const exprs, so "'x' as u8" does work in >> a constant position. >> >> But yes, I've wanted a shorter syntax for char-literals-as-bytes as >> well. Something like 'x'u8 perhaps? Or I guess we could just infer it, >> but that adds a fair amount of complexity to the typechecker. > > > Does it? I thought it'd just involve shifting char into the set of types > subject to integer-literal type inference. > > Maybe the default (not enough information to infer) would have to change > from int to char, for 'x', but otherwise I'd be surprised if it would be a > deep change. > > Lindsey can probably enlighten us more here..
It's been a while, but I think you'd just have to parse chars into lit_int_unsuffixed AST nodes rather than into lit_int. They would then be subject to integer-literal type inference. Unless I'm missing something, it wouldn't be hard. That said, I don't know if it's a good idea. Lindsey _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev