>
> If Julia were to allow prefix style method calls, such as
> myObject.myMethod() above, where would the system look for myMethod()?


It would check all signatures for myMethod to see if one of them takes
myObject as the first argument, just as now when when calling
myMethod(myObject, ...)


On Fri, Jan 10, 2014 at 3:59 AM, Marcus Urban <[email protected]> wrote:

> I have some concerns about how prefix-style method invocations, as in
> Java, would work with the existing structure of Julia. I am not trying to
> shoot down anyone's idea. I would just like to point out some issues.
>
> To be clear, the basic idea seems to be implicitly translating calls like
> obj.method(…) to a method with signature method(obj, …).
>
> In Java, for example, methods are declared inside a class. Suppose that
> myObj is an instance of MyClass. In the method call myObj.myMethod(), it is
> only necessary to look at the methods belonging to the actual type (class)
> of myObject, or one of MyClass's ancestors for an inherited method.
>
> If Julia were to allow prefix style method calls, such as
> myObject.myMethod() above, where would the system look for myMethod()? With
> Java, the answer is given above. WIth Julia, methods are not declared
> inside the type declaration, so the answer cannot be the same as with Java.
>
> One possibility is to broaden the scope to look at all methods declared in
> the module where MyClass is defined. This would give special status to
> these methods. Would a user be able to add new methods without editing the
> module where MyClass is declared? If so, how would these methods be
> indicated?
>

Reply via email to