develooper Front page | perl.perl6.internals | Postings from December 2001

Re: Generators -- Icon, Python, YAML and YATL

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
December 31, 2001 07:24
Subject:
Re: Generators -- Icon, Python, YAML and YATL
Message ID:
5.1.0.14.2.20011231102145.0225a048@pop.sidhe.org
At 04:08 PM 12/31/2001 +0100, Benoit Cerrina wrote:
> >
> > If you only allow yeilding from the outermost level of scope in a routine,
> > you can do evil things with Duff's Device. Which is what Python does. (But
> > it's sufficient for most purposes)
> >
> > Dan
> >
>Duff's device being evil enough in and out of itself I'm not sure I see what
>this
>has to do with yielding, it also only applies to c and c++...
>I think you mean break is a kind of yield but this is not the same.  Can you
>explain.

The details are in the archives for the LL1 list. (Off of ll1.mit.edu 
somewhere) Basically python fakes it under the hood and uses duff's as a 
dispatch method to the yielded spot. I didn't dig into it much--it was a 
clever hack, but insufficient in the general case.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About