Walter: any plan to add support for yield/return Iterators/generators?

Marcio mqmnews123 at sglebs.com
Tue Sep 5 18:24:39 PDT 2006


Walter Bright wrote:
>> One of the things needed for sure is heap frames.
> 
> That's right, instead of using the stack for the locals, the heap is 
> used. It isn't that much different from using a functor. In fact, now 
> that I think about it, a functor might be a better way to do it than yield.


	Smalltalk blocks, basically.

	But Smalltalk blocks prevented you from returning from the same 
enclosing method more than once. I wonder if the yield generator, with 
multiple yield return points, requires one to relax that or if it is 
just a compiler bag of tricks to provide such an illusion. In other 
words, Smalltalk has blocks but no syntax to do yield/return generators 
from a regular method. There must be extra tricks needed?

	Basically I think that yield/return (generators) are a high level 
mechanism, desirable even if your language has "functors".

marcio



More information about the Digitalmars-d mailing list