PROPOSAL: Named method parameters (original) (raw)

Paul Martin paul.martin at gmail.com
Sat Mar 21 09:48:54 PDT 2009


Hi,

Annotations should not affect the semantics of any other language construct. I think if you want to add support for named parameters, the support should be available everywhere.

Yes, perhaps this is contentious. I suppose that I had a few areas that I wanted to address:

I thought that the annotations are somewhat like @Override, in that we are not changing much of the behaviour of the compiled classes (other than automatically including appropriate generated @PublicNamedParameter annotation), since the selection of the method to be called and the order of the parameters will not change, but instead the annotations are primarily concerned with validating the code.

The alternative would be to allow named parameters to be used to call all methods. This could still be implemented by automatically generating @PublicNamedParameter annotations, so wouldn't necessarily affect the proposal much (and @PublicNamedParameters annotations could also be used on methods, etc. for documentation / IDE suggestion purposes if really required). However I couldn't think of a good solution when working with legacy class files (compiled prior to Java 7), since they would not support named parameters but it would not be obvious to a developer why they didn't. The annotations would at least make that explicit.

Do you think that there (language) areas that would not be covered by the use of named parameters?

What are the changes to the spec for overload resolution?

I thought that named parameters should not affect overload resolution at all

Do you think that named parameters in principle are a good/reasonable idea?

Thanks,

Paul



More information about the coin-dev mailing list