Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ease-dev] Overloaded methods support

It is an interesting current limitation of the modules implementation at the moment. If you want your user's to have an object, it is probably best to return an object from the module as the module isn't really a Java object.

Of course method overloading is supported when calling methods on Java objects. Nahsorn, Rhino, Py4j (for Python) all resolve the overloaded methods using rules similar to what Java does. The big difference is that the scripting languages call methods based on their runtime type, rather than their compile time type (as there is no compile time type). Nashorn and Rhino even provide a way to overcome that and be explicit about which overloaded method to call.



~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com

On 24 November 2017 at 11:55, Christian Pontesegger <christian.pontesegger@xxxxxx> wrote:

Hi,


overloading methods is not supported. We *could* make this work for methods having a different amount of parameters like in your case, but it would not work for methods having the same amount of parameters and just differ in the parameter type.


However currently this is not supported at all. In your example you either need to rename one of your methods or move one of the methods to another module.


Christian


On 24.11.2017 12:41, Serge Lamikhov-Center wrote:
Hi,

I am using EASE 0.4.0.

In my module, I'd like to provide object-oriented and functional interfaces for a function. For example, I have the following definitions for a function. Both function definitions have the same name, but, one of them is 'static':

public class DebugModule {
    @WrapToScript
    public static InstructionPointer stepIn(DebugModule module) {
        return module.stepIn();
    }
and 
    @WrapToScript
    public InstructionPointer stepIn() {
        ...
    }
}

In scripting, I am able to invoke this function as a method, but, the functional syntax invocation complains on the lack of such functions:
    dbg=getActiveSession();
    dbg.stepIn();            // Works good!
    stepIn(dbg);             // "JavaError: null" error

Is it expected?
BTW, documentation for the both functions has been generated successfully 😉, and, the both functions are appearing in the "Modules Explorer".

Would you please tell whether overloaded methods are supported?

Thank you,
Serge




_______________________________________________
ease-dev mailing list
ease-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ease-dev


_______________________________________________
ease-dev mailing list
ease-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ease-dev


Back to the top