Callbacks as our Generation's Goto Statement
tirania.org
Callbacks as our Generation's Goto Statement
1–10 of 287 posts
Re: Callbacks as our Generation's Goto Statement
#2Re: Callbacks as our Generation's Goto Statement
#3Re: Callbacks as our Generation's Goto Statement
#4Re: Callbacks as our Generation's Goto Statement
#5There's nothing more frustrating than trying to debug why a callback isn't being called. Who calls it? How do I set a breakpoint somewhere to see why it isn't being called? etc.
The one thing that is still missing from await and other green thread approaches is cheap global contexts. Isolating every different green thread so they can't implicitly share state is the obvious next step.
Re: Callbacks as our Generation's Goto Statement
#6This is what continuations are for.
Re: Callbacks as our Generation's Goto Statement
#7That's not obviously a good thing. Debugging the compiler (or just figuring out why it did something, even if correct) is far more difficult than debugging application code. Given the choice between implementing behavior with application code (or a library function) or adding semantics to the language, I prefer the former because it's much easier to reason about code written in a simple language than to memorize the semantics of a complex language.
[edited to replace sarcasm]
Re: Callbacks as our Generation's Goto Statement
#8http://praeclarum.org/post/45277337108/await-in-the-land-of-...
Basically, the author implements a “first time walkthrough” kind of interface a-la iWork very declaratively by using async:
async Task ShowTheUserHowToSearch ()
{
await Tutorial.EnterText (searchField, minLength: 3);
await Tutorial.Tap (searchButton);
await Tutorial.Congratulate ("Now you know how to search.");
}Re: Callbacks as our Generation's Goto Statement
#9I agree, although I think callbacks are more like COME FROM than goto. You see a function being passed somewhere as a callback, and you know the block is going to execute at some point, but most of the time you have no idea what the codepath that calls you back looks like. There's nothing more frustrating than trying to debug why a callback isn't being called. Who calls it? How do I set a breakpoint somewhere to see…