On Thu, Oct 23, 2008 at 10:34:49AM +0200, Alexander Burger wrote:
> On Wed, Oct 22, 2008 at 05:52:14PM +0100, Tomas Hlavaty wrote:
> > Well, I think this version has one important limitation: if Prg has a
> > recursive call(s) to foo, the deeper foo won't see any values set by
> > the foo above, or will it?
>
> Yes, that's right. 'run' takes care to skip the corresponding frames,
> because otherwise it would violate its own principle of undoing the
> local bindings of 'foo'.
>
> This has the drawback, of course, that you cannot bind things locally.
> This tradeoff has to be decided individually. Take 'scl' in "lib.l"
>
>(de scl (*Scl . "Prg")
> (run "Prg") )
> ...
> > So if I want to write recursive function, I cannot use (run ... 1).
> ...
> (case (up 2 @))
> (run "Prg") ) )
> ...
> So I would propose this construct, as a general recommendation to handle
> such functions. What do you think?
Now, thinking about all that, I feel that there must be a better
solution.
Generally, using 'run' with a binding offset is nice, and in some ways
more clear than using transient symbols and fiddling manually with the
bindings of '@'.
So I would propose to extend 'eval' and 'run' with another optional
argument
(eval 'any ['cnt ['lst]])
(run 'any ['cnt ['lst]])
'lst' can be a list of symbols, which are supposed to be *skipped* in
the process.
This would allow 'style' in "lib/xhtml.l" to be written without
transient symbols, without the (up 2 @), and a simple
(run Prg 2 '(*Style)) ) )
in the end.
It would probably also simplify '' a lot.
What do you think?
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]