Can a language support something like "Retry/Fix"?
- by Aaron Anodide
I was just wondering if a language could support something like a Retry/Fix block?
The answer to this question is probably the reason it's a bad idea or equivalent to something else, but the idea keeps popping into my head.
void F()
{
try
{
G();
}
fix(WrongNumber wn, out int x)
{
x = 1;
}
}
void G()
{
int x = 0;
retry<int>
{
if(x != 1) throw new WrongNumber(x);
}
}
After the fix block ran, the retry block would run again...