Re: Everyone's favorite flow control: retry
- From: MonkeeSage <MonkeeSage@xxxxxxxxx>
- Date: Mon, 3 Dec 2007 18:42:41 -0800 (PST)
On Dec 3, 8:22 pm, Charles Oliver Nutter <charles.nut...@xxxxxxx>
wrote:
MonkeeSage wrote:
As I understand, it's like a label in C. Charles' first example is
equivalent to something like this...
#include <stdio.h>
void foo(int (*pf)(const char *f, ...), char *a) {
(*pf)("%s\n", a);
}
int main() {
retry:
foo(&printf, "123");
goto retry;
return 0;
}
It's more than that...here's some pseudo C code:
void foo() { goto retry; }
int main() {
retry:
foo();
return 0;
}
Retry outside a rescue actually allows you to jump back across call
boundaries and start an invocation again. Scary.
- Charlie
Ah. How does it unwind the stack like that? Is that what you meant
about implementation specific stuff?
Ps. I don't think anyone will miss retry outside of a rescue. I won't
at least. :)
Regards,
Jordan
.
- Follow-Ups:
- Re: Everyone's favorite flow control: retry
- From: Charles Oliver Nutter
- Re: Everyone's favorite flow control: retry
- References:
- Everyone's favorite flow control: retry
- From: Charles Oliver Nutter
- Re: Everyone's favorite flow control: retry
- From: Gregory Seidman
- Re: Everyone's favorite flow control: retry
- From: MonkeeSage
- Re: Everyone's favorite flow control: retry
- From: Charles Oliver Nutter
- Everyone's favorite flow control: retry
- Prev by Date: Re: Ruby regexp Match
- Next by Date: Re: Ruby regexp Match
- Previous by thread: Re: Everyone's favorite flow control: retry
- Next by thread: Re: Everyone's favorite flow control: retry
- Index(es):
Relevant Pages
|