[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

This page is part of the web mail archives of SRFI 15 from before July 7th, 2015. The new archives for SRFI 15 contain all messages, not just those from before July 7th, 2015.

*To*: srfi-15@xxxxxxxxxxxxxxxxx*Subject*: Re: let-fluid problem*From*: Brad Lucier <lucier@xxxxxxxxxxxxxxx>*Date*: Sun, 14 Nov 1999 14:55:08 -0500 (EST)*Cc*: lucier@xxxxxxxxxxxxxxx (Brad Lucier)

To follow up on Olin's e-mail, I prefer dynamic-define, dynamic-ref, dynamic-set!, and dynamic-let as in Gambit-C, rather than fluid-let and friends. In particular, I don't like having to have variables with dynamic scope visible lexically in the context where they're used. Here is the relevant section from the gambit-c manual: @deffn {special form} dynamic-define @var{var} @var{val} @deffnx {special form} dynamic-ref @var{var} @deffnx {special form} dynamic-set! @var{var} @var{val} @deffnx {special form} dynamic-let ((@var{var} @var{val})@dots{}) @var{body} @cindex dynamic scoping @cindex dynamic variables @cindex variables, dynamic These special forms provide support for ``dynamic variables'' which have dynamic scope. Dynamic variables and normal (lexically scoped) variables are in different namespaces so there is no possible naming conflict between them. In all these special forms @var{var} is an identifier which names the dynamic variable. @code{dynamic-define} defines the global dynamic variable @var{var} (if it doesn't already exist) and assigns to it the value of @var{val}. @code{dynamic-let} has a syntax similar to @code{let}. It creates bindings of the given dynamic variables which are accessible for the duration of the evaluation of @var{body}. @code{dynamic-ref} returns the value currently bound to the dynamic variable @var{var}. @code{dynamic-set!} assigns the value of @var{val} to the dynamic variable @var{var}. The dynamic environment that was in effect when a continuation was created by @code{call-with-current-continuation} is restored when that continuation is invoked. For example: @example > (dynamic-define radix 10) > (define (f x) (number->string x (dynamic-ref radix))) > (list (f 5) (f 15)) ("5" "15") > (dynamic-let ((radix 2)) (list (f 5) (f 15))) ("101" "1111") @end example @end deffn Brad Lucier

- Prev by Date:
**let-fluid problem** - Next by Date:
**Re: let-fluid problem** - Previous by thread:
**Re: let-fluid problem** - Next by thread:
**[srfi-15] FLUID-LET wrapup** - Index(es):