Skip to content

Another syntax for extension methods? #7669

Closed
@odersky

Description

@odersky

The current syntax for collective extension methods is

given extension (t: T) with
  def f = ...
  def g = ...

or

given ops: extension (t: T) with
  def f = ...
  def g = ...

I think the following would read even nicer:

given (t: T) extended with
  def f = ...
  def g = ...

given ops: (t: T) extended with
  def f = ...
  def g = ...

Also, that way it is clear that the soft keyword extended is not a trait that is implemented by the given, which is a problem with extension.

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