[lambda-leftovers] Underscore parameter for abstract/native methods
brian.goetz at oracle.com
Sun Jun 25 21:47:20 UTC 2017
But, API points should have specification. How can one write a spec for a method parameter with no name? Not to mention that names in API points play a dual role in serving both the implementation and the client.
> On Jun 25, 2017, at 11:37 PM, John Rose <john.r.rose at oracle.com> wrote:
> 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