custom character literal macros? #26305
Labels
breaking
This change will break code
parser
Language parsing and surface syntax
speculative
Whether the change will be implemented is speculative
I wonder if we want to support character literal macros analogous to custom string macros, e.g.
b'x'
as a synonym forUInt8('x')
.This would be a breaking change because
b'x'
is currently parsed asb' * x'
:This occurred to me in connection with #26286, e.g. if you want to have custom literals for a new character type. Also, there is a lot of code that prints individual ASCII bytes to an
io
stream. To do this efficiently while still supporting streams in different encodings, you'd ideally want anASCIIChar
type, and it would be convenient to write this asa'x'
. Of course, we could define a custom string literal for this, likea"x"
, but it would be confusing if that were defined to produce a character.Not a necessary feature by any means, just wanted to throw it out there since it would be a breaking change.
The text was updated successfully, but these errors were encountered: