Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Re: Re: (Perl6) Groking Continuations

by John M. Dlugosz (Monsignor)
on Apr 11, 2003 at 21:49 UTC ( [id://249980]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: (Perl6) Groking Continuations
in thread (Perl6) Groking Continuations

So the (real) continuation (saved in a global variable) could be called even after the body of call_cc returned?

I see. If the function call activation frames are treated just like everything else, and there is no special action for "going out of scope", keeping a live reference to it is just like any other closure.

In Perl 6 we'll have to watch it because of the mechanism for having block-exit code in a finally clause or added dynamically by a caller. What would that do, if one can exit more times than enter?! (I have some ideas of what it should mean, but that's for another thread)

—John

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: (Perl6) Groking Continuations
by Elian (Parson) on Apr 11, 2003 at 22:55 UTC
    What it does is complicate things rather a lot. Continuations are an old, old language feature. Unfortunately many folks doing language work didn't think about then when new language features were developed, so there are things which may not necessarily play well with continuations. They'll work, but may not be an optimal combination.

    In the block exit case, finally clauses will be executed each block exit, which may be somewhat surprising, but not fundamentally an issue. The bigger issue is with things like local/temp/hpyothetical variables.

      So you could have it both ways: the finally block is done every time, and the restore code on a temp variable is done only when it's gone for good?

      But, I think many C++ programmers think of using the former for the purpose of the latter. Especially any code that wants to undo/fixate things by playing with the caller's blocks (as mentioned in earlier discussions) it needs to be clear that setting up something triggered when a variable goes out of scope (e.g. restore from a temp) is not the same as code that's simply inserted just before the close brace of that scope. Earlier, your comments about doing without prompt destruction made me think that we would indeed be using the "finally"-like mechanism for that purpose.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://249980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-03-28 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found