[plt-scheme] Newbie Schemer question

From: Anton van Straaten (anton at appsolutions.com)
Date: Wed Nov 6 16:30:22 EST 2002

> You talk about fluid-let, a special feature that could solve my problem.
> How does it work?

I didn't say fluid-let could solve your problem - I said it should not be
confused with the kind of dynamic variables I was talking about.  I don't
think fluid-let solves your problem, because it's still basically lexically
scoped, and if you begin using global variables with it, then you'll run
into issues with threads, based on what you've said.

(Docs on fluid-let are at
if you want to check anyway.)

 From your description, I think that Neil Van Dyke's suggestion may be best:
MzScheme's parameter feature.  It provides the ability to set up
thread-specific parameters, so that you can provide something that works
like the procedures current-output-port etc., that gives a different answer
on different threads:

You should be able to set up a procedure like (calling-device-id) that gives
thread-specific answers (if your script server is already going to be
running scripts on multiple threads anyway).  You would use the
'parameterize' form when invoking the script.

The other related docs to look at are those for MzScheme namespaces:

If you're using 'eval' at all - e.g., if the clients are separate processes
that are communicating over the network, for example - then namespaces could
allow you to eval a script with a different global namespace (again using
'parameterize'), with global variables set to the appropriate values for
that script.  This is closely related to the above solution, but I think the
above is better if you don't need to use 'eval'.

One of these should do what you need.


Posted on the users mailing list.