Closed jamadagni closed 2 years ago
In commit cb6aeda7ff3c1ed42bb04ed45ba26ce5061797f1 I've added a diagnostic to list ambiguous functions.
The error mesage for this case sheds light on the underlying issue, which has to do with the heavy use of casting in the contributed module geometry.asy that you are using:
-: 1.33: call of function 'operator ==(point, null)' is ambiguous:
bool(mass a, mass b) bool[](pair a, pair[] b)
Using alias(a,null) is a good solution.
I get:
A point is just another struct right? When the following code is valid:
and gives the (expected) output “yes”, I don't see why the same doesn't work for a point? Since the interpreter doesn't give clarity in the error message on what are the ambiguous candidates it is not easy for me to find what is wrong with
operator ==(point, null)
.To detect an uninitialized input point in a function, I found that
alias(p, null)
is the only way currently. See this post in the SF.net forum.It would be good if
operator ==(struct, null)
worked uniformly for all structs to detect uninitialized inputs, while one realizes that for non-struct types (which apparently includespair
s) this is not possible or only possible with more difficulty in the implementation.