Skip to content

Deprecate object $ to avoid unsoundess #1395

@nicolasstucki

Description

@nicolasstucki

The Scala spec states that identifiers that contain the $ characters are reserved for compiler-generated names. Any other use has undefined behavior.

One of these (object $) caused a bug in scala/scala3#19702. We are trying to add an ad-hoc patch to support these broken classes from Ammonite. But this patch cannot be guaranteed to work forever and there is no guarantee that these definitions do not introduce more issues (that may not be by the compiler).

The following names can cause undefined behavior: object $, package $file, package $exec, package $ivy, package $url, package $stub, package $cp, package $plugin, package $repo. These are defined in https://github.com/com-lihaoyi/Ammonite/blob/main/amm/interp/api/src/main/scala/ammonite/Stubs.scala. There might be more problematic names.

The only possible solution is to deprecate these objects and migrate to some sound naming scheme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions