Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Operator functions incompatible with multi-word operators #721

@yggdr

Description

@yggdr

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)).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions