groovysh bug? Cannot define a no-args closure which I can define outside of it.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

groovysh bug? Cannot define a no-args closure which I can define outside of it.

simonsharry
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line, I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.
        -----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>
       

3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS
Reply | Threaded
Open this post in threaded view
|

Re: groovysh bug? Cannot define a no-args closure which I can define outside of it.

Guillaume Laforge-4
That's a bug worth a JIRA issue.

Guillaume


On Sat, Jul 20, 2013 at 4:50 PM, simonsharry <[hidden email]> wrote:
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line,
I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.

-----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>


3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS




--
View this message in context: http://groovy.329449.n5.nabble.com/groovysh-bug-Cannot-define-a-no-args-closure-which-I-can-define-outside-of-it-tp5716267.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email





--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
Reply | Threaded
Open this post in threaded view
|

Aw: Re: [groovy-user] groovysh bug? Cannot define a no-args closure which I can define outside of it.

pschumacher
Looks like https://jira.codehaus.org/browse/GROOVY-2178 to me.
 
Gesendet: Samstag, 20. Juli 2013 um 22:10 Uhr
Von: "Guillaume Laforge" <[hidden email]>
An: "Groovy User" <[hidden email]>
Betreff: Re: [groovy-user] groovysh bug? Cannot define a no-args closure which I can define outside of it.
That's a bug worth a JIRA issue.
 
Guillaume
 
On Sat, Jul 20, 2013 at 4:50 PM, simonsharry <simonsharry@...> wrote:
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line,
I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.

-----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>


3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS




--
View this message in context: http://groovy.329449.n5.nabble.com/groovysh-bug-Cannot-define-a-no-args-closure-which-I-can-define-outside-of-it-tp5716267.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email

 
 
 
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Reply | Threaded
Open this post in threaded view
|

Re: groovysh bug? Cannot define a no-args closure which I can define outside of it.

pschumacher
Sorry, its not https://jira.codehaus.org/browse/GROOVY-2178. Groovy-2178 is just for multiline lists.

Note that you can just use:

foo = {
    println "test"
}

which works in groovyshell.


Looks like https://jira.codehaus.org/browse/GROOVY-2178 to me.
 
Gesendet: Samstag, 20. Juli 2013 um 22:10 Uhr
Von: "Guillaume Laforge" [hidden email]
An: "Groovy User" [hidden email]
Betreff: Re: [groovy-user] groovysh bug? Cannot define a no-args closure which I can define outside of it.
That's a bug worth a JIRA issue.
 
Guillaume
 
On Sat, Jul 20, 2013 at 4:50 PM, simonsharry <simonsharry@...> wrote:
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line,
I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.

-----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>


3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS




--
View this message in context: http://groovy.329449.n5.nabble.com/groovysh-bug-Cannot-define-a-no-args-closure-which-I-can-define-outside-of-it-tp5716267.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email

 
 
 
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: groovysh bug? Cannot define a no-args closure which I can define outside of it.

Jason Dillon-2
May want to update the "super insane hack" here:


… to ignore lines ending with "->"?

Though as blackdrag in GROOVY-2178 suggests, perhaps checking if the lines end with any of those chars (one of which is ">") is a more robust solution (yet still insanely hacky).

But, I've not looked at this code in years, and not sure I remember what its doing or why :-\

--jason

On July 20, 2013 at 11:59:31 PM, Pascal Schumacher ([hidden email]) wrote:

Sorry, its not https://jira.codehaus.org/browse/GROOVY-2178. Groovy-2178 is just for multiline lists.

Note that you can just use:

foo = {
    println "test"
}

which works in groovyshell.


Looks like https://jira.codehaus.org/browse/GROOVY-2178 to me.
 
Gesendet: Samstag, 20. Juli 2013 um 22:10 Uhr
Von: "Guillaume Laforge" [hidden email]
An: "Groovy User" [hidden email]
Betreff: Re: [groovy-user] groovysh bug? Cannot define a no-args closure which I can define outside of it.
That's a bug worth a JIRA issue.
 
Guillaume
 
On Sat, Jul 20, 2013 at 4:50 PM, simonsharry <simonsharry@...> wrote:
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line,
I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.

-----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>


3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS




--
View this message in context: http://groovy.329449.n5.nabble.com/groovysh-bug-Cannot-define-a-no-args-closure-which-I-can-define-outside-of-it-tp5716267.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email

 
 
 
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email
Reply | Threaded
Open this post in threaded view
|

did not find four digit huh?

Levi Yourchuck
In reply to this post by Guillaume Laforge-4

 Hi,

Just ran into this weird error.
Seem the parser does not respect commented out blocks...

Found this issue, listed as """major""", and """won't fix"""...  Anyone able to comment?
I don't get what the reason is for saying not an issue.

I found a workaround, easy enough.  But it took a half hour to discern the issue.
>>>> General error during parsing: Did not find four digit hex character code. line: 306 col:72 <<<<
Also, the error message does not state what file the parser has issues with.



Andres Almiray ?
Guillaume Laforge ?


If  you have a source file with anything in the comments like:

/*
  hey here lookie this:  "\uxxxxxxxx" what .....
*/

Compile error:

doing --> task ':compileGroovy'
[ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[ant:groovyc] General error during parsing: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]
[ant:groovyc] antlr.TokenStreamIOException: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:723)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:258)
[ant:groovyc]   at antlr.TokenBuffer.fill(TokenBuffer.java:69)
[ant:groovyc]   at antlr.TokenBuffer.LA(TokenBuffer.java:80)
[ant:groovyc]   at antlr.LLkParser.LA(LLkParser.java:52)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.sep(GroovyRecognizer.java:1351)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:692)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:130)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:107)
[ant:groovyc]   at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:160)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:843)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:149)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:179)
[ant:groovyc]   at org.codehaus.groovy.ant.FileSystemCompilerFacade.main(FileSystemCompilerFacade.java:27)
[ant:groovyc]
[ant:groovyc] 1 error
[ant:groovyc]





Thanks,
Levi
Reply | Threaded
Open this post in threaded view
|

Re: did not find four digit huh?

tim yates-2

From

http://groovy.329449.n5.nabble.com/grails-user-Groovy-Christmas-and-Happy-New-Year-tp373557p373561.html

> Groovy behaves exactly like Java in handling \u. These character sequences are processed before the lexer sees the character stream (see section 3.3 of the JLS).

On 21 Jul 2013 20:38, "Levi Yourchuck" <[hidden email]> wrote:

 Hi,

Just ran into this weird error.
Seem the parser does not respect commented out blocks...

Found this issue, listed as """major""", and """won't fix"""...  Anyone able to comment?
I don't get what the reason is for saying not an issue.

I found a workaround, easy enough.  But it took a half hour to discern the issue.
>>>> General error during parsing: Did not find four digit hex character code. line: 306 col:72 <<<<
Also, the error message does not state what file the parser has issues with.



Andres Almiray ?
Guillaume Laforge ?


If  you have a source file with anything in the comments like:

/*
  hey here lookie this:  "\uxxxxxxxx" what .....
*/

Compile error:

doing --> task ':compileGroovy'
[ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[ant:groovyc] General error during parsing: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]
[ant:groovyc] antlr.TokenStreamIOException: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:723)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:258)
[ant:groovyc]   at antlr.TokenBuffer.fill(TokenBuffer.java:69)
[ant:groovyc]   at antlr.TokenBuffer.LA(TokenBuffer.java:80)
[ant:groovyc]   at antlr.LLkParser.LA(LLkParser.java:52)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.sep(GroovyRecognizer.java:1351)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:692)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:130)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:107)
[ant:groovyc]   at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:160)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:843)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:149)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:179)
[ant:groovyc]   at org.codehaus.groovy.ant.FileSystemCompilerFacade.main(FileSystemCompilerFacade.java:27)
[ant:groovyc]
[ant:groovyc] 1 error
[ant:groovyc]





Thanks,
Levi
Reply | Threaded
Open this post in threaded view
|

Re: did not find four digit huh?

Levi Yourchuck
Tim,

Thanks for the info, it makes sense I guess since the source (as in the entire file) is Unicode.

One small error in that discussion there is: "Groovy behaves exactly like Java in handling \u"
In java the compiler error displays the file name and line index.
In groovy the compiler error displays neither.
 
 Thanks,
Levi
 
__________________________________________

From: Tim Yates <[hidden email]>
To: [hidden email]
Sent: Sunday, July 21, 2013 2:50 PM
Subject: Re: [groovy-user] did not find four digit huh?

From
> Groovy behaves exactly like Java in handling \u. These character sequences are processed before the lexer sees the character stream (see section 3.3 of the JLS).
On 21 Jul 2013 20:38, "Levi Yourchuck" <[hidden email]> wrote:

 Hi,

Just ran into this weird error.
Seem the parser does not respect commented out blocks...

Found this issue, listed as """major""", and """won't fix"""...  Anyone able to comment?
I don't get what the reason is for saying not an issue.

I found a workaround, easy enough.  But it took a half hour to discern the issue.
>>>> General error during parsing: Did not find four digit hex character code. line: 306 col:72 <<<<
Also, the error message does not state what file the parser has issues with.



Andres Almiray ?
Guillaume Laforge ?


If  you have a source file with anything in the comments like:

/*
  hey here lookie this:  "\uxxxxxxxx" what .....
*/

Compile error:

doing --> task ':compileGroovy'
[ant:groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[ant:groovyc] General error during parsing: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]
[ant:groovyc] antlr.TokenStreamIOException: Did not find four digit hex character code. line: 306 col:72
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:723)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:258)
[ant:groovyc]   at antlr.TokenBuffer.fill(TokenBuffer.java:69)
[ant:groovyc]   at antlr.TokenBuffer.LA(TokenBuffer.java:80)
[ant:groovyc]   at antlr.LLkParser.LA(LLkParser.java:52)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.sep(GroovyRecognizer.java:1351)
[ant:groovyc]   at org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:692)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:130)
[ant:groovyc]   at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:107)
[ant:groovyc]   at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:160)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:843)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501)
[ant:groovyc]   at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:149)
[ant:groovyc]   at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:179)
[ant:groovyc]   at org.codehaus.groovy.ant.FileSystemCompilerFacade.main(FileSystemCompilerFacade.java:27)
[ant:groovyc]
[ant:groovyc] 1 error
[ant:groovyc]





Thanks,
Levi


Reply | Threaded
Open this post in threaded view
|

Re: groovysh bug? Cannot define a no-args closure which I can define outside of it.

pschumacher
In reply to this post by Jason Dillon-2
Hello Jason,

thanks for the hint. :)

I created a jira issue https://jira.codehaus.org/browse/GROOVY-6272 for this and updated the "super insane hack" as you suggested https://github.com/groovy/groovy-core/commit/ffdcddfbeffff12ad07eba26f7d9b7e8ec927cb4 :)

-Pascal

Am 21.07.2013 21:23, schrieb Jason Dillon:
May want to update the "super insane hack" here:


… to ignore lines ending with "->"?

Though as blackdrag in GROOVY-2178 suggests, perhaps checking if the lines end with any of those chars (one of which is ">") is a more robust solution (yet still insanely hacky).

But, I've not looked at this code in years, and not sure I remember what its doing or why :-\

--jason

On July 20, 2013 at 11:59:31 PM, Pascal Schumacher ([hidden email]) wrote:

Sorry, its not https://jira.codehaus.org/browse/GROOVY-2178. Groovy-2178 is just for multiline lists.

Note that you can just use:

foo = {
    println "test"
}

which works in groovyshell.


Looks like https://jira.codehaus.org/browse/GROOVY-2178 to me.
 
Gesendet: Samstag, 20. Juli 2013 um 22:10 Uhr
Von: "Guillaume Laforge" [hidden email]
An: "Groovy User" [hidden email]
Betreff: Re: [groovy-user] groovysh bug? Cannot define a no-args closure which I can define outside of it.
That's a bug worth a JIRA issue.
 
Guillaume
 
On Sat, Jul 20, 2013 at 4:50 PM, simonsharry <simonsharry@...> wrote:
Hello,

1. I wanted to define this very simple no-args closure, foo, using groovysh:

        def foo = { ->
                println "test"
        }

2. But the moment I hit ENTER in the shell after typing out the first line,
I get the following error:

        $ groovysh
        Groovy Shell (2.1.5, JVM: 1.6.0_43)
        Type 'help' or '\h' for help.

-----------------------------------------------------------------------------------
        groovy:000> def foo = { ->
        ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
        startup failed:
        groovysh_parse: 2: unexpected token: -> @ line 2, column 13.
           def foo = { ->
                           ^

        1 error

                    at java_lang_Runnable$run.call (Unknown Source)
        groovy:000>


3. If, however, I put the above closure in a file x.groovy, and then do

        $ groovy x.groovy

then, there's no problem.

What's going on?

/HS




--
View this message in context: http://groovy.329449.n5.nabble.com/groovysh-bug-Cannot-define-a-no-args-closure-which-I-can-define-outside-of-it-tp5716267.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email

 
 
 
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email