From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Per Bothner Newsgroups: gmane.lisp.guile.user Subject: Re: translators and scoping rules (was: Re: language translator help) Date: Sun, 28 Apr 2002 08:26:45 -0700 Sender: guile-user-admin@gnu.org Message-ID: <3CCC14B5.6060407@bothner.com> References: <15561.38014.967466.255795@segfault.bogus.domain> <15563.18499.936272.639276@segfault.bogus.domain> <87662cnd8c.fsf@zagadka.ping.de> <15564.317.135557.127405@segfault.bogus.domain> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1020007668 8491 127.0.0.1 (28 Apr 2002 15:27:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 28 Apr 2002 15:27:48 +0000 (UTC) Cc: Marius Vollmer , guile-user Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 171qaZ-0002Cq-00 for ; Sun, 28 Apr 2002 17:27:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171qa0-00063J-00; Sun, 28 Apr 2002 11:27:12 -0400 Original-Received: from adsl-216-102-199-253.dsl.snfc21.pacbell.net ([216.102.199.253] helo=bothner.com) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171qYx-00060P-00 for ; Sun, 28 Apr 2002 11:26:07 -0400 Original-Received: from bothner.com (eureka.bothner.com [192.168.1.9]) by bothner.com (8.11.6/8.11.6) with ESMTP id g3SFagh19652; Sun, 28 Apr 2002 08:36:42 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc1) Gecko/20020417 X-Accept-Language: en-us, en Original-To: "John W. Eaton" Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:347 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:347 John W. Eaton wrote: > On 28-Apr-2002, Marius Vollmer wrote: > > | "John W. Eaton" writes: > | > | > How would you use eval to introduce a new local variable? > | > | You can't. If Octave needs this feature (but why?), > > Good question. I can't think of a really legitimate use, but it is > possible to do this in Octave/Matlab, so I was wondering whether it > could be emulated directly in Scheme. Am I right in guesing that Octave uses dynamic scoping, rather than lexical scoping? Certainly any local variable introduced by an eval cannot be lexically scoped. However, it can be a dynamic or "fluid" variable. So it would be consistent if all local variables were fluid variables. (Common Lisp uses the term "special" variables.) In a single-threaded environment it is easy implement dynamic/fluid variables: When the variable is defined, you set the variable in the global environment, but remember its previous value, if even. When you exit the variable's scope, you restore the previous value. It is harder to implement fluid variables in a multi-threaded environment, but there are various ways you can do it. (Kawa does support fluid bindings.) -- --Per Bothner per@bothner.com http://www.bothner.com/per/ _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user