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
That is an interesting case. What happens right now is that functions and constants can be provided by the scope passed to math.evaluate, but this will not have effect on operators. I.e. passing mod or add or so to scope will not replace the operators % and + etc. It makes sense that they would.
The purposeof this issue is to discuss whether overriding mod, add, etc. in the scope should affect the outcome of infix operators like %, +, etc. (And if the conclusion is so, serve as a marker that a PR to do this is needed.)
The text was updated successfully, but these errors were encountered:
I think we should strive for the operators to be exactly syntactic sugar for the function calls (even though they are generally the preferred read/write syntax). Therefore, their behavior should be the same.
Jos and I have discussed the possibility (in some issue or other, but sorry I couldn't find the reference) of collapsing FunctionNode and OperatorNode (with just a flag for whether it was written infix) into a single class. Overall, it seemed like a good idea. Obviously that will be facilitated by having the behavior be the same. :)
Yes, I agree. It makes a lot of sense. And I don't think there is a use case where you would not want the operators consistent with the corresponding functions.
So, let's go for it 👍 .
gwhitney
changed the title
Should it be possible to override operators with the scope?
Override operators with the scope just like functions
Jul 21, 2022
That is an interesting case. What happens right now is that functions and constants can be provided by the
scope
passed tomath.evaluate
, but this will not have effect on operators. I.e. passingmod
oradd
or so toscope
will not replace the operators%
and+
etc. It makes sense that they would.Originally posted by @josdejong in #2617 (comment)
The purposeof this issue is to
discuss whether overridingserve as a marker that a PR to do this is needed.)mod
,add
, etc. in the scope should affect the outcome of infix operators like%
,+
, etc. (And if the conclusion is so,The text was updated successfully, but these errors were encountered: