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
We simulate Python's "unbound method" syntax by allowing an instance method to be called on the class with an instance as an extra first argument. However, if there's a static method on the same class that also takes a first argument of that type, it's possible that this could cause an ambiguity which doesn't exist in Java, because it doesn't allow unbound syntax.
If the user has an instance, then the ambiguity can be resolved by calling either method through the instance instead, because in that context the two overloads will no longer have the same number of arguments. But if the user wants to call the static method, and doesn't have an instance to call it through, I don't think there's currently a workaround. So perhaps in the case of an ambiguous call through the class, we should try making another pass only considering static methods?
Or maybe an even simpler solution would be to just disallow unbound syntax for Java methods, since using bound syntax is always an alternative.
The text was updated successfully, but these errors were encountered:
We simulate Python's "unbound method" syntax by allowing an instance method to be called on the class with an instance as an extra first argument. However, if there's a static method on the same class that also takes a first argument of that type, it's possible that this could cause an ambiguity which doesn't exist in Java, because it doesn't allow unbound syntax.
If the user has an instance, then the ambiguity can be resolved by calling either method through the instance instead, because in that context the two overloads will no longer have the same number of arguments. But if the user wants to call the static method, and doesn't have an instance to call it through, I don't think there's currently a workaround. So perhaps in the case of an ambiguous call through the class, we should try making another pass only considering static methods?
Or maybe an even simpler solution would be to just disallow unbound syntax for Java methods, since using bound syntax is always an alternative.
The text was updated successfully, but these errors were encountered: