Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Magic::Attach & Co-routines?

by adrianh (Chancellor)
on Jan 21, 2003 at 14:48 UTC ( [id://228694]=note: print w/replies, xml ) Need Help??


in reply to Magic::Attach & Co-routines?
in thread RFC Magic::Attach

Anyone see a flaw or potential snags with this attack?

Co-routines that call co-routines are where it gets tricky for the algorithm you outlined. Consider this line in your example:

yield { $self->{left}->next_inorder } if $self->{left};

next_inorder is called recursively, and the context of yielding a yielded result should leave the execution within the recursive call to next_inorder.

You could make this example work by differentiating between a yielded result and a normal return. However, once you have code that has side effects it starts getting hard.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found