yield, C# etc
Denis Koroskin
2korden at gmail.com
Wed Aug 13 04:17:30 PDT 2008
On Wed, 13 Aug 2008 06:02:13 +0400, davidl <davidl at 126.com> wrote:
> 在 Wed, 13 Aug 2008 08:21:29 +0800,bearophile
> <bearophileHUGS at lycos.com> 写道:
>
>> This explains how C# implements a handy yield not far from the Python
>> one (Python one allows to create coroutines too):
>>
>> http://blogs.msdn.com/oldnewthing/archive/2008/08/12/8849519.aspx
>>
>> The syntax of yield is quite cleaner than the opApply (but maybe that
>> C# implementation is less efficient).
>>
>> Bye,
>> bearophile
>
> iirc, C#'s yield also allows to create coroutine.
>
I don't see much difference between "yield return i;" and "int result =
dg(i);".
First one is slightly cleaner while second one allows overloading.
Everything else is an implementation details.
More information about the Digitalmars-d
mailing list