| Ani-_ | avar: GOTO won't work in his case. |
| LeoNerd | leave 3; pop out 3 levels, wherever that takes us leave "foo"; pop out of the innermost function called "foo" |
| action | rindolf is not too intelligent to hack the perl5 code. |
| rindolf | is not too intelligent to hack the perl5 code. |
| action | avar licks Ani-_ |
| avar | licks Ani-_ |
| action | Chris62vw kicks avar in the balls |
| Chris62vw | kicks avar in the balls |
| LeoNerd | Perl6's one is even more powereful than that but I don't know how much we could easily do in perl5 |
| avar | ow Chris62vw ! |
| Ani-_ | LeoNerd: are you sure the code you gave (the sub ref) as an example is legal? |
| cfedde | breaks in structure can be convenient. but they should be used with caution. |
| LeoNerd | leave sub { prototype shift eq "($)" }; |
| Chris62vw | avar, sorry; I just experienced an "appendage malfunction" |
| LeoNerd | ^-- leave the innermost scalar operator :) |
| Ani-_ | LeoNerd: as in, what if: my $code; sub foo { $code = sub { leave &foo; }; } $code->(); # when leave is called it isn't in foo() |
| avar | ah, the hell? |
| LeoNerd | Ani-_: think of leave like a throw Ani-_: leave is basically a throw, that gets caught by something... |
| PerlJam | looks like there are more people drinking the perl6 kool-aid :-) |
| avar | caller.leave(1..3); |
| LeoNerd | The difference being that you pre-declare you want to catch, whereas everything is a potentially-valid target to be left |
| rindolf | Hi PerlJam |
| avar | mm, kool-aid |
| rindolf | PerlJam: I got fired. |
| LeoNerd | I imagine the behaviour for a non-matching leave would be similar to a non-matching throw |
| cfedde | rindolf: why's that? |
| PerlJam | rindolf: ouch! What did you do or not do to make that happen? |
| LeoNerd | I.e. fall out of the whole program |
| cfedde | too much irc? |
| PerlJam | cfedde: that would have been my first guess :) cfedde: my second would have been "too much non-work perl" |
| rindolf | PerlJam: well: http://shlomif.livejournal.com/39976.html |
| avar | leave is just to return from stuff that isn't a sub right? |
| LeoNerd | Ani-_: Thing is... there's more subtleness than that... consider in return EXPR; that EXPR knows the context of the calling sub... |
| avar | so says s06 |
| rindolf | cfedde: http://shlomif.livejournal.com/39976.html |
| avar | for 1 .. 5 -> $i { leave if $i == 4 } |
| japhy | if I have a process that spawns a handful of others, how do I make the parent of all of them wait for all of them to exit? |
| avar | waitpid? |
| LeoNerd | Ani-_: But a leave keyword would have to supply the right context to EXPR, which it could only know once it'd found the right callstack to exit from |