Named parameters, a possible implementation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Named parameters, a possible implementation

Marc Palmer Local
Hi,

I had a thought. Surely for groovy (non-Java) classes we can support  
named parameters? Who cares if the VM doesn't support it, can't the  
Groovy compiler create hidden implicit static map of MethodKey ->  
parameter name lists?

Then the MetaClass can hook into this data to help it resolve methods  
where a "Map" is passed in.

A suggestion for Groovy 2?

Marc


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Named parameters, a possible implementation

Guillaume Laforge
Administrator
Yup, a possible feature for Groovy 2.
If only Java's bytecode supported that...

On 5/2/07, Marc Palmer <[hidden email]> wrote:

> Hi,
>
> I had a thought. Surely for groovy (non-Java) classes we can support
> named parameters? Who cares if the VM doesn't support it, can't the
> Groovy compiler create hidden implicit static map of MethodKey ->
> parameter name lists?
>
> Then the MetaClass can hook into this data to help it resolve methods
> where a "Map" is passed in.
>
> A suggestion for Groovy 2?
>
> Marc
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Named parameters, a possible implementation

nickgrealy
Hi all,

Given that JDK8 now supports accessing named parameters at runtime, are there any plans to incorporate this into Groovy?

I've following up/posting this question on related(?) threads "Methods parameters names" and "Proposal: @NamedParameters AST transform". (Are there any more recent threads?)

Kind regards,

Nick Grealy