I'm close to finishing this, but would like to get feedback before
spending more time. Thoughts?
-Matt
An example can be viewed here:
http://gist.github.com/33787
I haven't done extensive testing, but seems to work.
-Matt
>
>
>
> On Dec 9, 12:24 am, Matt Revelle <mreve...@gmail.com> wrote:
>> The attached patch adds :super-methods option to generate-class as a
>> map, {local-name [name [param-types] return-type], ...}. The
>> mechanics work as Rich suggested in an earlier message, a method is
>> created that has the same type signature as the exposed method - it
>> loads the arguments, invokes the method, and returns the result.
>>
>> An example can be viewed here:http://gist.github.com/33787
>>
>> I haven't done extensive testing, but seems to work.
>>
>
> A couple of thoughts.
>
> First - the local name must be a valid Java method name - you are
> using dashes in your method names in the example code. Some VMs will
> balk at this.
>
>
> Second - it seems tedious and error-prone to have to specify the
> signatures, which must match the method sigs.
I was going for explicitness, but agree it's both tedious and error-
prone. Fixed.
>
>
> Third, if a method is overloaded, multiple :super-methods entries must
> be made.
>
> Perhaps it would be better, and more consistent with :exposes, to take
> a map of method_name -> exposing_method_name, and generate a set of
> overloaded methods matching all overloads of the super method:
>
> :exposes-methods {update super_update, render super_render}
>
> This way people can't get the sigs wrong, and a single entry covers
> all overloads.
Thanks for the feedback, attached patch uses the syntax you suggested
and constructs all overloaded variants of the specified methods.
Updated usage example:
http://gist.github.com/33787
Take care!
-Matt
Patch applied (svn 1149) - thanks!
Rich