-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add binary literals #8275
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
Add binary literals #8275
Conversation
|
see also: scala/docs.scala-lang#1464 |
| check_success("0b_1100 == 0xc", 0b_1100, 0xc) | ||
| check_success("0b_1101 == 0xd", 0b_1101, 0xd) | ||
| check_success("0b_1110 == 0xe", 0b_1110, 0xe) | ||
| check_success("0b_1111 == 0xf", 0b_1111, 0xf) |
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.
What, no 0b_1111_1111?
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.
that's uhh... 16 times as long >.>
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.
what I actually should have tested is 0b1 // Kenobi
|
Here is a branch https://github.com/som-snytt/scala/tree/review/binary-literals and commit som-snytt@d385d95 showing the small delta atop my other PR. |
som-snytt
left a comment
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.
This will look even better rebased on my other clean-up PR in scanners.
|
I also checked Maybe I'll take a few minutes this week to understand the overflow check. I was curious if there's an internal limit, but it's commented out: where cbuf is a |
2dcacfb to
d82ea91
Compare
|
Hmm, looks like this hasn't got much interest. I sent a bump in https://contributors.scala-lang.org/t/pre-sip-support-binary-integer-literals/3559/5 to see if anyone in the SIP committee wants to champion it, otherwise it should probably be closed as a Pre-SIP that didn't rally a champion. |
d82ea91 to
3cd508e
Compare
|
Thanks for publishing this Dale! |
|
Merging this would obligate the initial Scala 3.0 release to also support it, and Martin was adamant that the 3.0 plate is already full (reference: scala/docs.scala-lang#1639). There are starting to be more and more situations where a change needs to land first in Dotty, then be considered for a possible backport to Scala 2, and it seems this is one of them. On a positive note, the linked minutes also mention that a broader Dotty proposal around numeric literals more generally might open the door for this. |
|
I might open a PR against Dotty if I get the time; if that happens, I will link it here. |
|
Scala is the only place where binaries must agitate for inclusion. |
|
for PRs that are unable to progress in 2.13.x, we are closing them but leaving them on the 2.14.0-M1 milestone so we can find them later for context on this, see scala/scala-dev#661 |
No description provided.