C# iterators and suspend/resume in Simula 67

From: Jiri Kripac (jiri.kripac_at_autodesk.com)
Date: 02/20/04


Date: Thu, 19 Feb 2004 18:24:47 -0800

Languages such as Simula 67 contain a general concept of coroutines that
allow the execution of a method to be suspended without rolling back the
stack and then later resumed at the same place as it has been suspended.

The C# iterators seem to be a special case of this general suspend/resume
concept. The "yield" statement suspends the execution of the current method
and calling MoveNext() resumes it.

I think it would be cleaner to introduce the general suspend/resume concept
to C# and then implement C# iterators on top of this general foundation. The
way C# iterators have been added to C# seems to be somewhat ad hoc; it is a
very specific and distinct functionality that does not naturally blend with
the rest of the language.

Jiri



Relevant Pages

  • Re: C# iterators and suspend/resume in Simula 67
    ... > Languages such as Simula 67 contain a general concept of coroutines that ... > The C# iterators seem to be a special case of this general suspend/resume ... > I think it would be cleaner to introduce the general suspend/resume ... main problem is finding a real use outside of iteration where coroutines ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: C# iterators and suspend/resume in Simula 67
    ... C# has a yield statement? ... > The C# iterators seem to be a special case of this general suspend/resume ... > I think it would be cleaner to introduce the general suspend/resume ...
    (microsoft.public.dotnet.languages.csharp)

Loading