Sunday, December 26, 2010

Coroutines

The linked commit introduces coroutines in the Eiffel world.

The concept is implemented in the Liberty repository, but that should work in a pristine SmartEiffel too.

Enjoy!

2 comments:

  1. Maybe you should put an example on how to use those?

    ReplyDelete
  2. Yes, I should.

    The canonical way to implement a coroutine is to inherit from COROUTINE and implement the `invoke' feature using the `yield' call to return values.

    On the client side, the coroutine is used via an iterator (see the `item' feature), calling the coroutine and returning a new value each time `yield' is called.

    Meanwhile, there is a simple test case in the Liberty source.

    Happy new year :-)

    ReplyDelete