[ 
https://issues.apache.org/jira/browse/GROOVY-7651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14983978#comment-14983978
 ] 

Pascal Schumacher edited comment on GROOVY-7651 at 10/31/15 1:49 PM:
---------------------------------------------------------------------

Hi roroco,

groovy shell variables are untyped. You just write 

{quote}
groovy:000> a = []
===> []
groovy:000> a
===> []
{quote}

see 
[http://docs.groovy-lang.org/docs/next/html/documentation/#GroovyShell-Variables]
 for details.

If you want to use typed variables or def you can switch to interpreter mode:

{quote}
groovy:000> :set interpreterMode
groovy:000> def a = []
===> []
groovy:000> a
===> []
{quote}

[http://docs.groovy-lang.org/docs/next/html/documentation/#GroovyShell-Variables],
 but be warned that this mode has some know bugs in 2.4.x (which will be fixed 
in 2.5).


was (Author: pascalschumacher):
Hi roroc,

groovy shell variables are untyped. You can write just

{quote}
groovy:000> a = []
===> []
groovy:000> a
===> []
{quote}

see 
[http://docs.groovy-lang.org/docs/next/html/documentation/#GroovyShell-Variables]
 for details.

If you want to use typed variables or def you can switch to interpreter mode:

{quote}
groovy:000> :set interpreterMode
groovy:000> def a = []
===> []
groovy:000> a
===> []
{quote}

[http://docs.groovy-lang.org/docs/next/html/documentation/#GroovyShell-Variables],
 but be warned that this mode has some know bugs in 2.4.x (which will be fixed 
in 2.5).

> groovysh always raise "Unknown property: a" for a normal ArrayLIst
> ------------------------------------------------------------------
>
>                 Key: GROOVY-7651
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7651
>             Project: Groovy
>          Issue Type: Bug
>          Components: Groovysh
>    Affects Versions: 2.4.3
>            Reporter: roroco
>            Assignee: Pascal Schumacher
>
> reproduction:
> roroco@roroco-Zhaoyang-K49 /media/roroco/disk750/records $ groovysh
> Groovy Shell (2.4.3, JVM: 1.8.0_60)
> Type ':help' or ':h' for help.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> groovy:000> def a = []
> ===> []
> groovy:000> a
> Unknown property: a



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to