Closed dlfivefifty closed 5 years ago
I agree that this function does not look very "julian". It does have semantic consequences if we change this (like it did when it was introduced).
Part of the practical rationale for having indomain
is to reduce the chances of ambiguities. The in
function is very popular to overload. As things stand, concrete domains don't have to specify the type of x
in indomain
. I seem to recall this was different before when simply using in
, and x
would have to be typed just to avoid ambiguity.
Another part of the reasoning is that it allows for generic processing of whatever x
the user provides us with, regardless of the concrete domain. Currently, it seems we only ever call indomain
with an x
that has the element type of the domain, and in
also generically tries to convert a vector to the element type of the domain.
Of course any domain is always free to override in
and change this. Do you have an example of complexity being added, rather than removed, due to the current implementation of in
?
I think those are good points, lets leave it as is for now. (I forgot why I filed this issue.)
Okay. In general, feel free to make changes as you see fit, since you are clearly working on the code and we are not :-) We will adapt later.
I think I'm going to tag a version soon (and then tag ApproxFun). I don't know if I'll make many more changes.
I think the current implementation of
in
adds more complexity than it removes:I think it would be simpler if each domain just overloads
in
, and can handle types however it sees fit...