Why are negative value literals expressions?

I get that that's the way it is. The disagreement is that I, personally, think that a negative value should be a single literal and token. The way it is, it's literally (heh) impossible to write literals for half the value space of signed integers.

IMHO that's more than a bit weird: I'm not writing 127i8.wrapping_add(1), I'm writing 128i8, and if I leave it at that I get a compiler error. I still get an error if I write std::ops::Neg::neg(128i8). Yet I am able to write -128i8 and suddenly it works, even though by rights it should be treated the same.

3 Likes