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
Predef$Triple$ crashes the compiler #7251
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7251?orig=1 |
@retronym said: |
@Blaisorblade said:
Still, the parser could reject such identifiers, starting from 2.11, couldn't it? If they are actually unsupported, do not work and are not used, that should be OK. |
@retronym said (edited on Mar 13, 2013 10:01:39 PM UTC): The spec mentions:
|
@Blaisorblade said: It can make sense to give such a bug a low priority, but I'd say it's still a bug, because referring to identifiers with '$' must be allowed, as I'm going to explain. First, "'$' is reserved" means that it must not be used, not that it shouldn't be used. Also, "should" in a language spec reminds me of "undefined behavior" from C, something which Java removed from the world. Truth is, '$' is allowed by the JLS, so interoperability forces us to support using it. Still, one could forbid using it in definitions (and change the spec), and allow it in references. I suspect those could be distinguished at parse time. Quoting from http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8: "The "Java letters" include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ character should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems." The theoretical problem is that then one can't write a trait/class/object implementing the following Java interface: interface Foo {
void can$tOverrideMe();
} But I suspect that no such published interface exists. |
@paulp said: |
@paulp said: |
@retronym said: |
The text was updated successfully, but these errors were encountered: