Skip to content
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

Numeric literals should support "fill-in" underscores #6124

Closed
scabug opened this issue Jul 23, 2012 · 7 comments
Closed

Numeric literals should support "fill-in" underscores #6124

scabug opened this issue Jul 23, 2012 · 7 comments

Comments

@scabug
Copy link

@scabug scabug commented Jul 23, 2012

src/compiler/scala/tools/nsc/javac/JavaScanners.scala does NOT support literals like 123_456_789.
Since Java SE 7u4 (JDK 1.7 update 4), one can instantiate a java.lang.Long with java.lang.Long.valueOf (987_654_321).

I have prepared a "fix" for this, see the attachment.

At the same time, a similar patch adds support for underscores in numeric literals in Scala's own parser, namely src/compiler/scala/tools/nsc/ast/parser/Scanners.scala.

There is also a simple test object which compiles and runs with the two Scanners patched with the Patch files.

@scabug
Copy link
Author

@scabug scabug commented Jul 23, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6124?orig=1
Reporter: Carlo Dapor (catull)
Affected Versions: 2.10.0
Attachments:

@scabug
Copy link
Author

@scabug scabug commented Aug 4, 2012

@adriaanm said:
thanks for the patch! we should improve the Java scanner, but changing Scala syntax will require a SIP
a pull request on github for the java-side of things much appreciated (please sign the Scala CLA first)

@scabug
Copy link
Author

@scabug scabug commented Aug 14, 2012

@adriaanm said:
Thanks for signing the CLA, Carlo! (this serves as proof you did ;-) -- well, there's also the form we have on record in a file cabinet...)

@scabug
Copy link
Author

@scabug scabug commented Jul 20, 2015

@SethTisue said:
closing because it needs to go through the SIP process. the subject has come up in recent SIP meetings; there seems to be both some support and some opposition

@som-snytt
Copy link

@som-snytt som-snytt commented Jul 30, 2018

Patience is a virtue. There's talk recently of a micro-SIP process. A beer for Martin, a whiskey for Adriaan, and you're in. But you're on the hook for Seth for like your life. scala/scala#6989

@Ichoran
Copy link

@Ichoran Ichoran commented Jul 30, 2018

Sipping is already too small of a quantity to imbibe. What about a Gradually Updated Language Process?

@hrhino
Copy link
Member

@hrhino hrhino commented Jul 30, 2018

Does Adriaan get the Scotch or the Bourbon? and who gets the other one?

Also, I assume the beer must be a micro-brew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants