On Friday, 27 July 2012 at 19:17:10 UTC, H. S. Teoh wrote:

Nevertheless, D has gotten to the point where it's powerful enough that most feature requests can be implemented in a
library rather than as a language extension.

How could Yield be implemented as a library feature? Something like:

   return ITERATOR(
      { ...setup code ... },
      { ...loop body code... })

?

I don't see how that would work. Variables declared in the setup would not be accessible from the body. I guess it could be done a bit like this:

   Enumerable!int ExampleFunction() {
      ... create some variables ...
      return ITERATOR!int( {
         ...do something with variables...
         ...return something...
      } )
   }

That the kind of thing you mean?

Reply via email to