PROPOSAL: Named method parameters (original) (raw)

Howard Lovatt howard.lovatt at iee.org
Sun Mar 22 04:08:24 PDT 2009


Hi All,

Couple of points:

  1. Named parameters with default values can be coded reasonably easily at present:

    public class MyClass { public static class Args { public String name = "Fred"; public

int age = 53; } public MyClass(Args args) { .... } }

MyClass mc2 = new MyClass( new MyClass.Args() {{ name = "Joe"; }} );
  1. If some construct that allowed for new classes to be generated with less syntax made it into Java at some point in the future, e.g. http://www.artima.com/weblogs/viewpost.jsp?thread=182412 (which I suggested), then the above method would be even easier. Therefore it might not be a good time to introduce this since it could become obsolete.

  2. It would be good if anything in this space was consistent with JavaFX (which has named parameters), so that call compatibility can be ensured.

-- Howard.



More information about the coin-dev mailing list