[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ease-dev] Overloaded methods support
|
Let me add one more thought: For _javascript_ you may provide optional parameters. In Java you would have one method with an annotated parameter like this: @WrapToScript public void foo(@ScriptParameter(defaultValue=”whatever”) String yourParameter) {} your script code then may call foo() with or without parameter. In the second case the default parameter provided in the annotation will be passed to the java call. While defaultValue always needs to be provided as a string, we do our best to convert it to the current parameter type. HTH Christian From: ease-dev-bounces@xxxxxxxxxxx [mailto:ease-dev-bounces@xxxxxxxxxxx] On Behalf Of Jonah Graham Sent: Mittwoch, 6. Dezember 2017 14:42 To: ease developer discussions <ease-dev@xxxxxxxxxxx> Subject: 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.
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: 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 { public static InstructionPointer stepIn(DebugModule module) { 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.stepIn(); // Works good! stepIn(dbg); // "JavaError: null" error 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? _______________________________________________ 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
|
Attachment:
smime.p7s
Description: S/MIME cryptographic signature