On Tue, Dec 9, 2008 at 4:28 PM, Matt Revelle <[EMAIL PROTECTED]> wrote:
>
> On Dec 9, 2008, at 10:03 AM, Rich Hickey wrote:
>
>>
>>
>>
>> On Dec 9, 12:24 am, Matt Revelle <[EMAIL PROTECTED]> 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
>

Patch applied (svn 1149) - thanks!

Rich

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to