-
Notifications
You must be signed in to change notification settings - Fork 4
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
Discussion of proposal 2015-006 (Additional string conversion functionality) #7
Comments
I think that the REs for specifying the accepted formats are not the right ones. I propose
In other words, allow the underscore as a digit separator, but not as a initial or terminal character BTW, this change agrees with the way that I wrote up this feature in the Proposed Definition of SuccessorML. |
Good point. Shouldn't the underscore at least be allowed after a |
Something like
for decimal literals and
for hexadecimal literals (modulo the SML tilde as minus). Are there other examples of languages that use underscore in numeric literals that we might compare to? |
So Ocaml has also introduced them a while ago. It does not seem to allow an underscore after Whatever we pick, the rules for word prefixes should be consistent with it. |
The reference states
but the implementation may do something different. |
Java only allows underscores between digits, but allows an arbitrary number of them. see here. |
On Tue, Aug 18, 2015 at 8:54 AM, John Reppy [email protected]
|
@rossberg I think the text in the Rust language reference could possibly be more clear on this point: https://doc.rust-lang.org/stable/reference.html#integer-literals |
So it looks like the Rust language should be
|
In the MLton implementation (https://github.com/MLton/mlton/blob/master/mlton/front-end/ml.lex#L152), we require leading and trailing digits and no consecutive underscores. As I recall, there is no ambiguity or lexical trouble allowing leading or trailing or repeated underscores, although it has some very minor impacts on backwards compatibility: fun foo _1__2_ = true
| foo _ _ _ _ _ _ = false |
This discussion should is better attached to the Successor ML Definition; the Basis Library should follow whatever we agree to do there. I've created an issue for that purpose. |
Closed by mistake. |
it’s very minor, but it might be worth it to be compatible with ocaml’s notation. i can’t really say why, except that further divergence isn’t helpful. bob Bob Harper [email protected]
|
This issue is for discussion of proposal 2015-006 (Additional string conversion functionality).
The text was updated successfully, but these errors were encountered: