[lambda-leftovers] Underscore parameter for abstract/native methods

John Rose john.r.rose at oracle.com
Sun Jun 25 21:37:27 UTC 2017


On Jun 25, 2017, at 3:51 AM, Tagir Valeev <amaembo at gmail.com> wrote:
> 
> Currently in lambda-leftovers underscore is allowed as a parameter name for
> abstract methods. This looks dubious as normally underscore means that
> parameter is not used in the corresponding method/lambda/catch body

I don't find this dubious at all.  If the method declaration doesn't have a
visible body, then the method descriptor is all there is, which means it's
an API point.  An underscore simply means that the designer of the API
point has elected not to give a name to the method.  That doesn't imply
any semantic weight (plus or minus) to the runtime value that get passed
at that position in the argument list.

So I don't think there's any particular reason to mandate, in the language,
that there must be a restriction on where _ can be used to indicate "no name".
Recommending where _ should be used seems to me a job for a style guide,
not a language specification.

— John


More information about the amber-dev mailing list