Impressed

Stuart stugol at gmx.com
Fri Jul 27 12:22:47 PDT 2012


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?


More information about the Digitalmars-d mailing list