PROPOSAL: Method and Field Literals

Howard Lovatt howard.lovatt at iee.org
Wed Mar 18 23:39:02 PDT 2009


A couple of points:

1. This would be a nice addition to the language

2. Make it orthogonal so that you don't make Java harder to learn,
i.e. use JavaDoc syntax, allow fields, methods, constructors, and
*classes*.

3. Deprecate .class and replace with #class, Java shouldn't have new got'yas.

4. ArrayList#ArrayList() isn't a problem, it can mean constructor
access in Java and the exotic identifier syntax can be used for
non-Java names containing hash.

5. You don't have to solve all the problems on day one; we can come
back and make the Field/Method literals better in future Java versions
(also see next point), e.g. fix Field and Method to be generic.

5. If a source statement, see source and encoding proposal on coin, is
added to Java then this proposal doesn't prevent future expansion of
Java. In particular:

    A. If a new inner-class/closure/method-reference syntax is added
to Java then it can use a keyword instead of having to reuse #, JavaFX
for example uses function.

    B. A new keyword can be used for MethodHandels.

    C. A new keyword can be used for reflective property access



More information about the coin-dev mailing list