Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator functions incompatible with multi-word operators #721

Closed
yggdr opened this issue Feb 19, 2023 · 3 comments
Closed

Operator functions incompatible with multi-word operators #721

yggdr opened this issue Feb 19, 2023 · 3 comments

Comments

@yggdr
Copy link

yggdr commented Feb 19, 2023

Right now coconut's operator functions are restricted to single-word operators.(is) and (+) work as expected, but (is not) and (not in) are CoconutParseErrors. This is currently not explicitly stated, the multi-word operators are simply missing from the list of available operator functions, making it easy to gloss over the list of operator.<something> that come from python, and concentrating only on the new coconut operators.
So if this restriction isn't easy to lift, I'd like to suggest adding a warning about it to the docs and refer to the example from the addpattern-decorator-section, that uses a function composition (. is None) ..> (not).

This came about when I tried using them in pattern matching with implicit partial application of the form (. <op> <arg>). Here I have seen an additional gotcha: while (is not) is an invalid operator function, (. is not None) is valid and is compiled like (. is (not None)).

@evhub evhub added this to the v3.0.0 milestone Feb 19, 2023
@evhub
Copy link
Owner

evhub commented Feb 19, 2023

As a workaround, you should be able to do

(is) ..> (not)

or even

operator is_not
(is_not) = (is) ..> (not)

evhub added a commit that referenced this issue Feb 19, 2023
@evhub evhub added the resolved label Feb 19, 2023
@evhub
Copy link
Owner

evhub commented Feb 19, 2023

This is live now on coconut-develop>=3.0.0-a_dev11.

@evhub evhub closed this as completed Feb 19, 2023
@yggdr
Copy link
Author

yggdr commented Feb 19, 2023

Wow, that is impressive! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants