Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Character Literals (#1934) #1964
Character Literals (#1934) #1964
Changes from 6 commits
d2538d8
4c38941
df98ff4
05b9a18
c4e54c1
3fde33a
5d1d2f9
d618da8
8dfd0d7
a72e990
5d0df06
a147db0
b700b7f
334a7a0
bdf44ea
b4daeb0
398f742
7e01c75
fbbbccb
2d7c899
ebf2548
d95e3b1
d8111ba
b4d3ec2
b44c751
aafeac0
def0273
21e53b3
f1d5602
091ba9c
50470e8
7c0829e
e8454f7
a2c0a90
9e5ecb9
5f2ce1e
951b6b7
b6345d9
4f7d678
09ca59e
7f91aa4
4dcc633
153e1a5
8b15cbc
d321b37
8eacb58
377096c
8d34805
0caa49f
df0fb9c
0b4451c
1a53051
2f4eb91
61180df
174a551
d9a1b99
4d3204d
98864dd
4aff5f2
680ed7c
c119ee9
be7cbf0
5418553
abea9b7
051b100
7c7950e
c53a4ce
223aaa5
63f2f41
7667e25
d35c1f6
e1810da
10b660d
606219e
1abad92
d165370
78192d3
f6eeff6
cb7e896
7a94dfc
afad667
2393390
e222263
d862fdb
cb1c1e5
5d15fec
2ebf115
d1af3a7
44ff724
a86d571
842ab4d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One consequence appears to be that this is invalid:
... and something like
return ('0' as Char32) + n;
would be needed instead. I think I'm OK with that, but I expect it to be a minor source of friction as that kind of usage is fairly common in C++.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that
'0' + n
has a value that is only known at runtime, what type should it be? Using the type ofn
here is a bit worrisome, due to overflow. I would be fine with saying the result would beChar32
, but maybe that would only make sense for some types ofn
? For example ifn: i64
, aChar32
result would be surprising.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I like keeping this super-explicit for now (requiring a cast to a specific sized type). We can try to add better defaults if in practice this friction is something users dislike. I'm somewhat hopeful that instead we can have a really easily discovered (and targeted in migration) API for mapping to digits, and avoid how much this comes up in practice. But it seems easy to address if it does come up.