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.

-Matt


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Attachment: genclass_expose-super-methods.diff
Description: Binary data



On Dec 8, 2008, at 10:59 AM, Rich Hickey wrote:

>
>
>
> On Dec 8, 9:30 am, Matt Revelle <[EMAIL PROTECTED]> wrote:
>> I'm working on a patch to add support for calling the superclass'
>> implementation of a method when overriding a method in Clojure with
>> ns/:genclass.  This looks like it requires a modification of the
>> InstanceMethodExpr class in clojure.lang.Compiler.  The proposed
>> syntax would be: (. super/MethodFoo this args).  One issue is that
>> using super/MethodFoo to refer to the superclass' method means that
>> (.super/MethodFoo this args) wouldn't work without more Parser  
>> changes.
>>
>> I'm close to finishing this, but would like to get feedback before
>> spending more time.  Thoughts?
>>
>
> I would set aside the syntax and first describe the mechanism. Are you
> going to generate a super-calling version of every method? Are you
> going to try to emit code to generate invokespecial in the
> implementing fn? The latter won't work as there is no type
> relationship.
>
> It might be easier to just enhance the :exposes to handle methods as
> well, or add a  :supers section.
>
> 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