From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jon Wilson Newsgroups: gmane.lisp.guile.user Subject: Re: modify environments to make sandboxes Date: Tue, 27 Jun 2006 23:13:12 -0500 Message-ID: <44A201D8.4080401@fastmail.fm> References: <20060612182036.2c989469@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1151468010 19115 80.91.229.2 (28 Jun 2006 04:13:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jun 2006 04:13:30 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jun 28 06:13:27 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FvRQW-0001Sk-Vu for guile-user@m.gmane.org; Wed, 28 Jun 2006 06:13:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvRQW-0005cw-D6 for guile-user@m.gmane.org; Wed, 28 Jun 2006 00:13:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FvRQS-0005bv-Kj for guile-user@gnu.org; Wed, 28 Jun 2006 00:13:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FvRQR-0005b9-T1 for guile-user@gnu.org; Wed, 28 Jun 2006 00:13:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvRQR-0005ax-P7 for guile-user@gnu.org; Wed, 28 Jun 2006 00:13:15 -0400 Original-Received: from [131.225.111.11] (helo=mailgw1.fnal.gov) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FvRch-0004Se-3i for guile-user@gnu.org; Wed, 28 Jun 2006 00:25:55 -0400 Original-Received: from mailav1.fnal.gov (mailav1.fnal.gov [131.225.111.18]) by mailgw1.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with SMTP id <0J1J00CXGYDDSG@mailgw1.fnal.gov> for guile-user@gnu.org; Tue, 27 Jun 2006 23:13:14 -0500 (CDT) Original-Received: from mailgw2.fnal.gov ([131.225.111.12]) by mailav1.fnal.gov (SAVSMTP 3.1.7.47) with SMTP id M2006062723131430888 for ; Tue, 27 Jun 2006 23:13:14 -0500 Original-Received: from conversion-daemon.mailgw2.fnal.gov by mailgw2.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) id <0J1J00I01YB2Q3@mailgw2.fnal.gov> (original mail from j85wilson@fastmail.fm) for guile-user@gnu.org; Tue, 27 Jun 2006 23:13:14 -0500 (CDT) Original-Received: from [192.168.2.4] (d53-64-59-128.nap.wideopenwest.com [64.53.128.59]) by mailgw2.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with ESMTPSA id <0J1J00FDRYE1L2@mailgw2.fnal.gov>; Tue, 27 Jun 2006 23:13:14 -0500 (CDT) In-reply-to: <20060612182036.2c989469@localhost.localdomain> Original-To: Mildred X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5388 Archived-At: Hi all, How about having the ability to capture the current lexical environment and use it as an environment for eval? Something like call/cc, but I guess call/env. In essence, this would make environments useful as first class objects (perhaps). (define my-env #f) (let ((a 0) (b 1) (c 2)) (call/env (lambda (x) (set! my-env x)))) (eval '(begin (display a) (newline) (display b) (newline) (display c) (newline) (display my-env) (newline)) my-env) >> prints: 0 1 2 # Perhaps an unlet would also be useful. This would create a lexical environment in which several variables were unbound. (unlet (eval read load) (call/env (lambda (x) (set! my-env x)))) (eval '(eval '(+ 1 2)) my-env) => #error Hmmm, perhaps this idea (unlet) couldn't work in any kind of a sensible, simple, lexical scoping system. Maybe unlet could just set the variables given to it to # or #f or something. So, which extant language feature have I overlooked that provides more or less exactly this? :) Regards, Jon Mildred wrote: > Hi, > > I'm new to this mailing list and also new to the scheme language ... > I'm used to Lua but I try to search about functionnal programming, and > I found scheme. It looks like a good language but before using it in my > projects I would like to know if tere is an easy way to create > sandboxes. > > In lua, it is easy, you create a table containing functions ... and the > table can be made environment for a function. So, you can easily create > secure sandboxes by loading lua code from file and changing the > environment of the loaded code. > > I do not know how to do that in scheme. Apparetly the function > null-environment can return an environment and eval can evaluate some > code in an environment. But the question is how to define a variable in > an environment and also how to undefine a variable that you don't want > to appear. > I didn't found anything about modifying an environment. Is it > possible ? If not, why not ? and is it possible to create sandboxes ? > Thanks > > Mildred > _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user