On Fri, Jan 02, 2009 at 06:06:31PM -0800, Geoffrey Broadwell wrote: : Meaning, the gather/take syntax doesn't make much sense, because we're : not "gathering" anything; the PID file handler has nothing to return. : We'd only be using it for the "side effect" of being able to pause the : callee's execution and resume it later.
Leaving aside for the moment the question of how much we want mere mortals to know about continuations when normal closures would do, I think you're falling into a kind of P5Think here, that all forms of nothing are equivalent. A take always returns a Capture object, so at minimum you're gathering a list of Captures, even if they're empty. If you like, you could also think of gathering continuations or closures, depending on whether the object you take closes over return context or just the rest of the current call. In any case, I dislike the overloading of the function interface that happens with many standard coroutine designs. That's why gather/take is orthogonal to the function call interface. As for syntactic relief, that will always be a macro away in Perl 6, if you really want it. But I think "return {...}" and "take {...}" are nice, explicit idioms for returning a closure, and we've gone to some pains in Perl 6 to make a bare block behave that way without a keyword, so I'm not in a hurry to huffmanize away a mere two characters for what what many readers would view as a form of obfuscation. As for true reusable continuations, I'm not opposed to having them available in the language per se, but they're hard to implement on some architectures, and I'll certainly frown on any attempt to confuse them with either normal closures or even single-use continuations in the minds of mere mortals. Using bare continuations where gather/take or closures will do is like throwing out your steak knives because they duplicate the functionality of your chain saw. :) Larry