Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CCDB5200C7F for ; Wed, 24 May 2017 10:58:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CA428160BB4; Wed, 24 May 2017 08:58:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1C5B8160B9C for ; Wed, 24 May 2017 10:58:11 +0200 (CEST) Received: (qmail 90768 invoked by uid 500); 24 May 2017 08:58:11 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 90650 invoked by uid 99); 24 May 2017 08:58:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2017 08:58:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1FA09C4557 for ; Wed, 24 May 2017 08:58:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.301 X-Spam-Level: X-Spam-Status: No, score=0.301 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ooQnp2S8Y5Aj for ; Wed, 24 May 2017 08:58:06 +0000 (UTC) Received: from smtpout20.partage.renater.fr (smtpout02-ext4.partage.renater.fr [194.254.241.31]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C3C2E5FD7D for ; Wed, 24 May 2017 08:58:05 +0000 (UTC) Received: from zmtaout02.partage.renater.fr (zmtaout02.partage.renater.fr [194.254.241.30]) by smtpout20.partage.renater.fr (Postfix) with ESMTP id BA3E6C0418 for ; Wed, 24 May 2017 10:57:58 +0200 (CEST) Received: from zmtaout02.partage.renater.fr (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTPS id A2DA020056 for ; Wed, 24 May 2017 10:57:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id 8EB9B20053 for ; Wed, 24 May 2017 10:57:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at zmtaout02.partage.renater.fr Received: from zmtaout02.partage.renater.fr ([127.0.0.1]) by localhost (zmtaout02.partage.renater.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DQKmOyuq0nNJ for ; Wed, 24 May 2017 10:57:58 +0200 (CEST) Received: from zstore27-staff.partage.renater.fr (zstore27-staff.partage.renater.fr [10.254.241.53]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id 66B1E20056 for ; Wed, 24 May 2017 10:57:58 +0200 (CEST) Date: Wed, 24 May 2017 10:57:58 +0200 (CEST) From: Remi Forax To: dev@groovy.apache.org Message-ID: <1353330842.1919456.1495616278344.JavaMail.zimbra@u-pem.fr> In-Reply-To: <49116f79-5bc4-f923-2ef5-f2795b7a94fc@gmx.org> References: <49116f79-5bc4-f923-2ef5-f2795b7a94fc@gmx.org> Subject: Re: groovysh and local variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [194.254.242.1] X-Mailer: Zimbra 8.6.0_GA_1200 (ZimbraWebClient - FF53 (Linux)/8.6.0_GA_1200) Thread-Topic: groovysh and local variables Thread-Index: 7JVFS/kDEKabiIV1X7dctHYHDAkt3w== archived-at: Wed, 24 May 2017 08:58:13 -0000 Hi Jochen, jshell, the equivalent of groovysh for java included in 9, does something l= ike this, it stores the content of all variables declaration as fields into a synthet= ic class and all statements as method so statement have access to the conte= nt of the field. But because you have bindings in groovy, it may be simpler ? (i do not know= if bindings are typed ?) cheers, R=C3=A9mi ----- Mail original ----- > De: "Jochen Theodorou" > =C3=80: dev@groovy.apache.org > Envoy=C3=A9: Mercredi 24 Mai 2017 09:49:32 > Objet: groovysh and local variables > Hi, >=20 > a User on the user-list mentioned it is currently not possible to define > a local variable in one evaluation and use it in the next. So for example >=20 > > def x =3D 10 >=20 > > println x >=20 > this fails because the eval for println x has no knowledge about x=3D10. >=20 > Is this correct, did we have any plans to change this? I mean I know why > it behaves like that and as a script you would get the same. But in the > context of groovysh I really wonder if that makes sense. We could > extract the top level local variables using a transform and make them > and their values available to the next evaluation >=20 > bye Jochen