Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Make List.tail a final (val) #50

@alexandru

Description

@alexandru

Hello,

I was just wondering whether this has ever been discussed for changing in the new implementation, sorry if it has been, but I can't find an issue:

final case class ::[B](override val head: B, private[scala] var tl: List[B]) extends List[B]

That var makes List a thread unsafe data-type, breaking users expectations, because it's only final values that guarantee that that tl won't be seen as null after the constructor of :: has finished. Users imo expect final values and thread-safety. The ListBuffer trick is cool, but it's not worth it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions