ARM syntax and new keywords

Neal Gafter neal at gafter.com
Thu Nov 26 12:48:48 PST 2009


On Thu, Nov 26, 2009 at 10:30 AM, David Goodenough <
david.goodenough at linkchoose.co.uk> wrote:

> On Thursday 26 November 2009, Neal Gafter wrote:
> > Now that jdk7 will include a syntax for using names that are otherwise
> > keywords (the syntax is #"name"), the backward-compatibility breakage of
> > adding a new keyword is much less severe.  Also, context-sensitive
> keywords
> > are a true-and-tried technique, just not used yet in Java.
> >
> I hope that the # operator will be available for both methods and fields.
> This was discussed early on in the Coin process, in my lightweight
> properties
> proposal.  It is really the only bit of that proposal that is needed, the
> rest
> can be done in other ways.
>

This has nothing to do with closures (there is a separate email list for
that anyway).  The #"name" syntax was added to give a way of using "exotic"
identifiers that would otherwise be disallowed.  For example, if you have a
method pre jdk7

  int foobar(int x) { return x + 1; }

and then we add a keyword "foobar" to the language in jdk7, you can still
use the identifier "foobar" by modifying the source as following

  int #"foobar"(int x) { return x + 1; }

This is even possible for package names, though a bit awkward

  package #"foobar";

Cheers,
Neal



More information about the coin-dev mailing list