On May 18, 2008, at 6:54 PM, Neal Gafter wrote: > The set of characters acceptable to the VM in identifiers was > expanded in Java SE 5, and includes virtually every unicode > character except a few that have special meaning to the VM, such as > '[', ';', '/', etc:
For a longer treatment of this issue, and a good JVM-level solution, see the entry on "symbolic freedom" in my blog http://blogs.sun.com/ jrose . The JVM allows almost any string as a class, field, or method name. I think the only reasonable way to serve many languages at once, with good integration, is to agree on a convention for escaping (quoting, lightly mangling) the few remaining illegal JVM names and have languages use this convention in their backends and introspectors. That way Scheme (or whoever) can just use names like + and / without having a global prohibition against the latter, because of internal JVM encoding conventions. Also, Java should have a convention for escaping names not otherwise allowed in the JLS, with the same conventions for escaping at the JVM level. That way it can be used as a systems programming language for the JVM, even for languages that have non-JLS identifiers. Backslash would work: > int \+(int x, int y) { return x+y; } > int foo() { return \+(1, 0); } So would string or char quotes (as in Groovy): > int '+'(int x, int y) { return x+y; } > int foo() { return this.'+'(1, 0); } > // qualified literal is a literal name, not string or char Best, -- John P.S. Some would suggest backquote, as an unused quote-like character. I don't favor this, because some language projects use backquote for experimental syntaxes. It's not an important enough feature on which to waste a new punctuation character. There are a suggestion on record for using underbars to escape Java keywords, but that is not a general enough solution. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---