[plt-scheme] let vs parameterize?

From: Yin-So Chen (yinso.chen at gmail.com)
Date: Mon Apr 16 16:41:47 EDT 2007

Thanks Robby/Carl (and Eric for answering privately) -

here's a related question:  Does parameterize automatically uses a custodian
(e.g. current-custodian) to manage resources or custodians have to be used
explicitly?

On 4/16/07, Robby Findler <robby at cs.uchicago.edu> wrote:
>
> Another difference between parameters and fluid-let: in a fluid-let
> the values are not thread local, but in a parameter they are.
>
> Robby
>
> On 4/16/07, Carl Eastlund <cce at ccs.neu.edu> wrote:
> > On 4/16/07, Yin-So Chen <yinso.chen at gmail.com> wrote:
> > > What is the difference between using let vs parameterize?
> >
> > Let operates on bindings.  It creates a new name and binds it to a
> > value.  This affects code directly within the let-body that refers to
> > the same name, providing it is not bound again ("shadowed") inside the
> > let.
> >
> > Parameterize operates on parameters, which are values.  It takes an
> > existing parameter and makes it return a different value during the
> > execution of the body of the parameterize.  This affects any code
> > called during that execution, even if it's in a different function,
> > module, whatever, so long as it uses the same parameter value.
> >
> > > It seems that one can use let to manipulate parameter objects (at
> least
> > > scheme doesn't forbid it) - any issues with using it?
> >
> > Let does not manipulate values at all.  It just binds names to
> > existing values.  It never changes values or their contents.
> >
> > >  How do I know whether or not something is a parameter versus a
> variable?
> >
> > You could ask the same thing about numbers vs variables, or strings vs
> > variables.  A variable is a name for a value.  That value might be
> > anything: number, string, list, parameter, etc.  But you should be
> > careful never to confuse the name with what it refers to.
> >
> > And in response to the followup email: fluid-let, like let, operates
> > on variables (names), not values.  Hence it would not be an
> > "extension" to make it work on parameters.  If you give the name of a
> > parameter to fluid-let, it will change which parameter that name
> > refers to, not the contents of the current parameter.
> >
> > --
> > Carl Eastlund
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
>



-- 
http://www.yinsochen.com
...continuous learning...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070416/9b8aad33/attachment.html>

Posted on the users mailing list.