PROPOSAL: Named and Optional parameters, "Java-style"

Reinier Zwitserloot reinier at zwitserloot.com
Wed Oct 19 19:50:08 PDT 2011


This is one of those features that's near the top of my 'want' list, but,
this proposal is not complete. The issues that I see with it:

(A) How does this affect resolution of methods? If I have public void foo()
and public void foo({int named = 5}), and somewhere also I call foo(), which
method is called? Or, alternatively, how is the compiler going to prevent
both of these methods existing? Will class files that somehow contain both
anyway fail in the verifier, or is there an obscure resolution algorithm in
these rare cases?

(B) Your plan of sticking the relevant type information in an annotation
doesn't work, because the classes you can stick in an annotation value
cannot be generified, so, you can make int.class, but you can't make
List<Integer>.class, just List.class.

 --Reinier Zwitserloot



More information about the coin-dev mailing list