Closed kim8823 closed 6 months ago
I suppose we can detect that the name of the function is a valid operator, and then remap the signature this way...
Let me try that out.
One thing is that certain code out there may depend on the fact that the name of the function is at the beginning of the signature...
For example, if you get an ErrorFunctionNotFound
, it is not necessarily due to your function not being found... it could be a dependency function that is not found. So usually you have to check the signature before you decide that, yes, the function is not there.
I can add a new ErrorOperatorNotFound
, but then it'd be a breaking change.
I have fixed the position of the error such that it now points to the operator instead.
Closing this for now. Feel free to reopen.
This is just a cosmetic issue and not even strictly wrong. The part of the source text that forms the function-call expression does indeed start there, but it would still be nice if the error actually pointed at the operator symbol.
Come to think about it, the wording could also be improved to say "Operator" and maybe even show the signature as infix syntax. The current message might be pretty confusing to rhai-only users that have nothing to do with embedding the engine.