static method calls in groovy

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

static method calls in groovy

Jochen Theodorou
Hi all,

recently I talked with someone about how to make static method calls in
a dynamic language like groovy. I think we talked about using casts for
this, which is surely an ugly solution. Not because of the syntax,
because of the possible implication this gives. Well he basically
suggested to write

   foo<Foo>.bar<String,int> (a,b)

for a method call to bar(String,int) on the class Foo. This is still
ugly. Our solution for the future would be a, (int) b)

which is also not the best one I think. But, the suggested form with
foo<Foo>.bar<String,int> would allow the compiler to generate a direct
method call, a sure improvement in speed. We would only have to check
that there is no interception which fits with the new MOP I think.
Additionally we talked about adding the classes to "invokeMethod". With
this solution we would not have to do that.

I just want to start a discussion about this

bye blackdrag