[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Re: tcp-read-timeout: procedure or parameter?
From: |
Tobia Conforto |
Subject: |
Re: [Chicken-users] Re: tcp-read-timeout: procedure or parameter? |
Date: |
Mon, 7 Jul 2008 10:18:17 +0200 |
William Xu wrote:
I read the srfi-39 carefully. It appears that it can be more or
less expressed by simple lexical scoping. So what's the extra
benifits of using `parameter'?
First of all, the macro you refer to is called `parameterize', not
`parameter', and it's just a shorthand for setting a new value before
the body and then resetting the old value at the end of the body.
The benefits of parameters are dynamic scoping and thread safety.
Contrary to function arguments and let forms, parameters are
dynamically scoped, much like global variables, or "special variables"
in other lisp dialects. This is very handy for setting and querying
generic, global configuration items, without "passing state"
explicitly between function calls, which is what parameters (and
global variables) are commonly used for.
Contrary to global variables, parameters are thread-local, so every
thread has its own set of parameter values.
The combination of these two features makes parameters very useful.
Tobia
- Re: [Chicken-users] Re: tcp-read-timeout: procedure or parameter?,
Tobia Conforto <=