Skip to content

Ref and Ref.View for single should be the same instance #34

@nbronson

Description

@nbronson

The only method signatures that Ref and Ref.View have in common are those inherited from AnyRef. This implies that if we are careful in our definition of equals we can use the same instance for both the reference and the single-operation view! This would avoid any object creation overhead for the use of .single.

Direct use of the concrete instances such as TIntRef would no longer be convenient, because an ambiguity would be created. When typecast to either a Ref[Int] or Ref.View[Int], however, things would work fine.

Is this clever or evil?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions