groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinko Srko─Ź <dinko.sr...@gmail.com>
Subject Re: vararg syntax question
Date Tue, 07 Jul 2015 19:49:10 GMT
I can't prove it, but I don't think anything changed between 2.1.6 and
2.1.8 regarding handling (named) parameters. Even more, I don't think
anything changed there for a long time.

I tried your example with 1.8.6, 2.1.6, 2.1.8, and 2.4.1 and all those
versions behave the same.

Example that I tried:

    def openModalWindow(Map options=[:], Object screenName) {
        println "screenName=$screenName, options=$options"
    }

    def t1 = 'foo'
    def stuff = 42

    openModalWindow 'EditScreen', fromType: t1, withData: stuff
    // prints: screenName=EditScreen, options=[fromType:foo, withData:42]

Cheers,
Dinko

On 7 July 2015 at 21:24, Ralph Johnson <johnson@cs.uiuc.edu> wrote:
> I switched compilers from 2.1.6 to 2.1.8 and something broke.  I am thinking
> that perhaps an old language feature went away.
>
> We have scripts that say something like
>
> openModalWindow 'EditScreen', fromType: t1, withData: stuff
>
> and it gets translated into a call on
>
> def openModalWindow(Map options=[:], Object screenName) {
>
>          ...
>
> }
>
> where options will be the map {fromType: t1, withData: stuff} except that it
> has the values of the variables t1 and stuff.  Did this go away?  If so,
> what should I replace it with?   I can't actually find documentation for it,
> which leads me to believe it was deprecated.  I

Mime
View raw message