Is it possible to override ? (ternary operator)? #679
Unanswered
mdmcconnell
asked this question in
General
Replies: 2 comments
-
Here is some patcher code that seems to work, but I don't feel confident enough about my understanding of ast to trust it completely. It would be nice to be able to use the built-in operator override mechanism.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
It is possible to override only binary operators. X?y:z isn’t possible to override. But you can patch it to your needs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying to override the ? operator because I would like it to deal with nil values. Expr accepts my call to expr.Operator("?", "ternWithNil") and complains if I haven't registered ternWithNil function in the environment, and will complain about the signature if the target function doesn't have two (why two?) input parameters and one return value, however it never seems to reach my code. Is it possible to override ? without building a patcher?
Beta Was this translation helpful? Give feedback.
All reactions