Skip to content

Coconut 2.0 pattern-matching changes #605

@evhub

Description

@evhub

For Coconut 2.0, there will be non-backwards-compatible changes in pattern-matching syntax. Specifically:

  • Python-style pattern-matching constructs will become the default (see Integrate Python 3.10 pattern matching #558).
    • Thus, vector(x, y) will need to be written as data vector (x, y) and
    • {"a": a, "b": b} will need to be written as {"a": a, "b": b, **{}}.
  • =<expr> will be removed and should instead be written ==<expr>.
  • x is int will be removed and should instead be written int() as x or x `isinstance` int.
  • With is no longer meaning isinstance, is <expr> will now be allowed in patterns to mean identity comparison.

A --coconut-syntax-version flag should be added to allow the old syntax to help in porting old codebases to 2.0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions