<<< Date Index >>>     <<< Thread Index >>>

Re: ^R / ^D and threads



* On 2003.11.14, in <20031114084311.GD4959@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
*       "Thomas Roessler" <roessler@xxxxxxxxxxxxxxxxxx> wrote:
> 
> It might be easier to implement a per-variable stack, so you could
> do something like this:
> 
>       push resolve
>       set resolve=yes
>       exec delete-thread
>       pop resolve
> 
> Thoughts?

I've been intending for some time to patch in a variable stack (in my
copious free time), but I had planned it just to be a single stack, and
I think I still prefer that.

Your example above would still work; it's even the same syntax I'd
imagined. But I'd add dup and exch operations, and allow pop to run with
no arguments just to pop the top value without an accompanying set.
This would allow the stack to be used for swapping values between two
variables, too:

push foo        # save $foo on stack
push bar        # save $bar on stack
pop foo         # assign $bar's value to foo
pop bar         # assign $foo's value to bar

The exch and dup are just sugar, really, that I can imagine someone
would come up with a use for -- perhaps to mitigate the problems
with using a single stack instead of multiple.

-- 
 -D.    dgc@xxxxxxxxxxxx
 University of Chicago > NSIT > VDN > ENSS > ENSA > You are here
 .  .  .  .  .  .  .
 always line up dots