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 38387200B71 for ; Wed, 31 Aug 2016 08:44:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 33DC9160AB4; Wed, 31 Aug 2016 06:44:05 +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 75756160A8C for ; Wed, 31 Aug 2016 08:44:04 +0200 (CEST) Received: (qmail 87678 invoked by uid 500); 31 Aug 2016 06:44:03 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 87668 invoked by uid 99); 31 Aug 2016 06:44:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Aug 2016 06:44:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id CFB0718061E for ; Wed, 31 Aug 2016 06:44:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id u-cfW2Cq_0jw for ; Wed, 31 Aug 2016 06:44:00 +0000 (UTC) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 220BA5F39A for ; Wed, 31 Aug 2016 06:44:00 +0000 (UTC) Received: by mail-lf0-f45.google.com with SMTP id p41so10894216lfi.1 for ; Tue, 30 Aug 2016 23:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=IC/FJ3kLfZ/szLNKyprXLG02va4V+UoXnSflSVk/8cE=; b=MuGmlmesNu++G1yY+cdwaCOAAXgZ+j0KYCfBMpxMCSRWqTf15XWXl4cETOlgmeWYmS exDtFvv7AA++sl+JbnKYm9s+zBSPpN2AgD2soZlVe3U/BmVR0Ra/Ii6+QYa3Vi/eQvl8 to4Kvx3z7lFJ5eddaSDY/rQGWi3ZIzOLgPJajpLuLhqxt3NEWdcpqHKHSAGOw5yIxGgm FRd8AAFg7jYk9YnRC3mildLxVhfA4RswpNRHVu9Hx2jyAZvMSuavzfYA9BX5Cyj8zk/Q /fvYfDGOYe9gUCb/tpeBRn56VFmauxzc1cbERge0JxqiRAvjlQOlM1uP8zsjCXyoGm+2 v01w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=IC/FJ3kLfZ/szLNKyprXLG02va4V+UoXnSflSVk/8cE=; b=lri0a63/TPGAjwjRw57gOMF1bjCV5aZdyxpyTD85+wGwkP077NBh9Uguijqua1Xsep 3zoK1txZZloyGU5IdQIN9BGT1E95T6cLkBfYvS2G5MlwULiLhijB6Ye8JA5t/uNqh8fE H6NecMOQb291s5smVYDrM1ZyIThROHOlTUrrQ6GPfS/FJiQNnXjuagaOZOaujoSEWT/T WJd9ZWXC75emFLURDVVLe5nZeWftpIbs73l+MR0MDyL9QK/HMNe1j8bjae7BngKaOi4d mifmnqHmTtWP4zGHg4tjOcidpAn36UUt3ER/OzdSPSXr95MQ4/MfQFzuBz9D7UwVKoqg V2Ag== X-Gm-Message-State: AE9vXwPthV4dOQv8AwGfOIQmx6DjzYsmYVfzVzzC2N8jdkcj03sHcDRQUf+KEh0UVeABctGwjqVdMEc2n1dQ6Q== X-Received: by 10.46.32.5 with SMTP id g5mr2526788ljg.53.1472625839359; Tue, 30 Aug 2016 23:43:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.144.7 with HTTP; Tue, 30 Aug 2016 23:43:58 -0700 (PDT) Received: by 10.25.144.7 with HTTP; Tue, 30 Aug 2016 23:43:58 -0700 (PDT) In-Reply-To: References: From: Thibault Kruse Date: Wed, 31 Aug 2016 15:43:58 +0900 Message-ID: Subject: Re: access to local variables in scripts To: users@groovy.apache.org Content-Type: multipart/alternative; boundary=001a1142be9a0acab0053b586ca3 archived-at: Wed, 31 Aug 2016 06:44:05 -0000 --001a1142be9a0acab0053b586ca3 Content-Type: text/plain; charset=UTF-8 Hi Ralph, I think I maybe did something similar for groovysh, see here: https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy In method evaluateWithStoredBoundVars() I think this was based on some blog article by Guillaume about variable bindings. Hope that helps. On Aug 31, 2016 01:19, "Ralph Johnson" wrote: > I have a system that executes scripts written by users. I'd like to > provide more debugging tools. In particular, I'd like to be able to > display the values of variables that the script uses. Some of the > variables are defined outside the script, and I can access and display > them. But the script might use "def" to define some more variables, and > I don't know how to access them. When a script runs, does it have some > kind of context object in which it stores temporary variables? Is there a > way I could access it so I could read those variables? If so, what is it > called and where could I learn more about it? > > -Ralph Johnson > --001a1142be9a0acab0053b586ca3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Ralph,

I think I maybe did something similar for groovysh, see here= : https://github.com/apache/groovy/blob/master/subprojects/groovy-groovysh/s= rc/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
In method evaluateWithStoredBoundVars()

I think this was based on some blog article by Guillaume abo= ut variable bindings.

Hope that helps.


On Aug 31, 2016 0= 1:19, "Ralph Johnson" <= johnson@cs.uiuc.edu> wrote:
I have a system that executes scripts writt= en by users.=C2=A0 I'd like to provide more debugging tools.=C2=A0 In p= articular, I'd like to be able to display the values of variables that = the script uses. =C2=A0 Some of the variables are defined outside the scrip= t, and I can access and display them. =C2=A0 But the script might use =C2= =A0"def" to define some more variables, and I don't know how = to access them. =C2=A0 When a script runs, does it have some kind of contex= t object in which it stores temporary variables?=C2=A0 Is there a way I cou= ld access it so I could read those variables? =C2=A0 If so, what is it call= ed and where could I learn more about it?

-Ralph Johnson=
--001a1142be9a0acab0053b586ca3--