Re: Lua Gems: Filters, Sources, Sinks and Pumps
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua Gems: Filters, Sources, Sinks and Pumps
- From: Diego Nehab <diego@...>
- Date: 2008年12月19日 17:04:29 -0500 (EST)
Hi,
Now I am reading Diego Nehab's gem on "Filters, Sources, Sinks and Pumps".
To my surprise he does not mention coroutines. I think coroutines with
their "yield" and "resume" are great mechanism to implement filters
and filter chains. They provide an easy and natural way to maintain
filter context while processing chunks of data. Also coroutines all
but eliminate (or rather hide) need for "pumps".
Is there any specific reason they are left out of this gem??
The original implementation actually used coroutines for the
filter chains. Unfortunately, this caused the library to
interfere poorly with pcall(), and some users complained.
The implementation of the smtp.message() function used as an
example the end of the Gem does use coroutines.
As to the relationship between pumps and coroutines, would
you mind clarifying?
Kind regards,
Diego