Skip to content

Add support for ignoring function arguments #5449

Open
@scabug

Description

@scabug

When a method of a specific signature needs to be implemented, it would be helpful to somehow mark the arguments that are not going to be used.

Currently, the best solution is that we assign an argument name that hints that it is obviously not going to be used.

def render(dontUseMe: NodeSeq) = {
  ...
}

I propose that we add a yet additional usage of the underscore, this time for ignoring a method argument.

def render(_: NodeSeq) = {
  ...
}

This should fit in nicely with the already existing method of ignoring the argument when creating a function value:

val render = (_: NodeSeq) => {
  ...
}

It is also compatible (in spirit) with the pattern matching system for ignoring everything but the type of the argument.

case _: NodeSeq =>
  ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions