ilya.gorbunov
02/06/2018, 12:50 AM1b
can be confused with hexadecimal literalianbrandt
02/06/2018, 12:56 AM0x
, do they not? (https://kotlinlang.org/docs/reference/grammar.html#HexadecimalLiteral)ilya.gorbunov
02/06/2018, 1:40 AM0x
prefix, it would be confusing.
And in fact we can't:
val x: Byte = 0x1b
is a perfectly valid hexadecimal literal byte value (27)ianbrandt
02/06/2018, 2:29 AMval a = 1b // Byte, 0b0000_0001
val b = 27b // Byte, 0b0001_1011
val c = 0x1b // Int, 0b0001_1011
val d: Byte = 1b // Byte, 0b0000_0001
val e: Byte = 0x1b // Byte, 0b0001_1011
All the same, 'y/Y' could be used instead: http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000905.htmlbenleggiero
02/06/2018, 5:33 AM0b
also looks like a dangling beginning of a binary literal, like 0b101
ilya.gorbunov
02/06/2018, 3:24 PMval long = 0x1L
now, and then he would expect being able to change L
to b
to have the literal typed as Byte
, but instead it would become an Int
with a completely different value.ianbrandt
02/06/2018, 4:10 PM