Currently we iterate through all the methods to find one matching the parameters on stack, trying to convert the parameters for every method. Maybe we should provide a way to let the user specify the signature of the target method, so that we can jump right to that method without all those iterations.
Operator mangling
Since we made JFunctions closures, we may replace the original object calling grammar into the signature'd calling grammar:
javaObject:toString()
-- With signature
javaObject('toString', '')()
Consider static methods, you won't expect the following method calling to be anything other than constructor calling:
String = java.import('java.lang.String')
s = String('string')
We must not use the above grammar, maybe later...
(jobject/'int,int,java.lang.String'/'methodName')(1, 2, 'Hello')
-- or
(jobject/'int,int,java.lang.String'):methodName(1, 2, 'Hello')
-- or
java.call(jobject, 'methodName', 'int,int,java.lang.String')(1, 2, 'Hello')
The most ideal one may be:
jobject.methodName['signature'](1, 2, 'Hello')
-- have to be
jobject.methodName['signature'](jobject, 1, 2, 'Hello')
Currently we iterate through all the methods to find one matching the parameters on stack, trying to convert the parameters for every method. Maybe we should provide a way to let the user specify the signature of the target method, so that we can jump right to that method without all those iterations.
Operator mangling
Since we madeJFunction
s closures, we may replace the original object calling grammar into the signature'd calling grammar:Consider static methods, you won't expect the following method calling to be anything other than constructor calling:
We must not use the above grammar, maybe later...
The most ideal one may be:
But we lose track of
jobject
.Keyword abuse
Use Java reserved words.