View Single Post
Old 07-17-2003, 07:02 PM   #4
JilesDM
Member
 
Join Date: Nov 2002
Posts: 66
JilesDM is on a distinguished road
If you want to bind to an arbitrary global variable in the same object as the closure is being constructed in, it's simple:
[code] string x;
closure f;

x = whatever_variable_name;
f = lambda(({}),({#'write,({#'apply,symbol_variable(x) })}));
[/quote]

The key here is remembering to run the symbol returned by symbol_variable through apply or funcall.
JilesDM is offline   Reply With Quote