Juerd <[EMAIL PROTECTED]> writes:

> I thought temp replaced local. 

temp is dynamic scoping, the same thing as Perl5's local.

Hypotheticals are the ones that turn permanent if everything succeeds
according to plan but revert to the old value if stuff fails -- a
rollback mechanism, basically.  I was just about to mention
hypothetical scoping wrt undo but for some reason did not.  

In fairness to the undo suggestion, there is a significant difference:
to use hypotheticals to revert you have to plan the reverting when (or
before) you make the change.  I think continuations work this way also
(except that they don't just revert one thing).  This sounds like a
no-brainer (i.e., you're writing the code that uses undo so obviously
you planned at coding time to do the reversion) until you think about
putting references into the mix; with undo you could revert an
arbitrary item.

One thing worth noting about .undo is that retrofitting it later would
not break backward-compatibility at the language level.  It would be
one heck of a messy change under the hood, but any user who wasn't
using it wouldn't have to even know about the change.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"[EMAIL PROTECTED]/ --";$\=$ ;-> ();print$/

Reply via email to