You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has now been implemented, but it's been done in a way that I actually think will be pretty backwards-compatible, potentially obviating the need for any sort of backwards-compatibility flag. In particular:
=<expr> and x is int still work, they just print warnings (errors on --strict) and
vector(x, y) still works, since Coconut will now dynamically check to see whether vector is a data type or not to determine whether to do data matching or class matching by default.
Thus, the only real backwards-compatibility issue here is dict patterns, which will need to have **{} added to them to continue working as they previously did. Seems like it's not worth adding a flag just for that, though.
For Coconut 2.0, there will be non-backwards-compatible changes in pattern-matching syntax. Specifically:
vector(x, y)
will need to be written asdata 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 writtenint() as x
orx `isinstance` int
.is
no longer meaningisinstance
,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.The text was updated successfully, but these errors were encountered: