On Thu, Apr 5, 2012 at 4:47 PM, Stas Malyshev <smalys...@sugarcrm.com>wrote:
> > However, in general, thinking about more complex flow control structures > in fine. Just there's no reason to get exceptions mixed into it. > > Agreed. While restarting and resuming after exceptions could be useful, and a condition signaling control structure could also be useful, the two should be distinguished at the language level (even if they were implemented using the same mechanism under the hood). So, what do people think of some sort of retry mechanism for exceptions? What about a (separate) condition signaling control structure? What about serializable continuations, allowing for resuming execution in a separate request? CPS offers an alternative to the first two. As much as the idea appeals to me, retries seem less useful to me in PHP than in other languages unless (as Rasmus initially suggested) execution were serializable, which I suspect would be a heavy feature. Serializable continuations would require the most work to implement using PHP if it's never supported by the language itself. I suspect that serializable continuations will be space-inefficient no matter where they're implemented. Web continuations may not be common practice now, but part of the reason for that may be lack of support. It could become more popular if it were available. On the other hand, PHP's heritage as a templating language means serializable continuations may be just as much a problem as "die" or "exit" is, as they can result in invalid HTML.