lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tuesday 01 February 2011 17:50:49 Chris Babcock wrote:
> On Tue, Feb 1, 2011 at 5:50 AM, Steve Litt <slitt@troubleshooters.com> 
wrote:
> > I don't think I have to get them to understand coroutines, if I can get
> > them to salivate about them. How could I, within 5 minutes, demonstrate a
> > wonderful benefit of coroutines?
> 
> My personal favorite... filters:
> http://lua-users.org/wiki/FiltersSourcesAndSinks

Devils advocate:

Why use filters in Lua coroutines when you could do:

grep -v .jpg$  access_log | grep -v .gif$ | grep -v .class$ | \
calculate.lua | add_hdrs_and_footers.lua | \
sort | report.lua > traffic_report.txt

The preceding uses code pieces tested over and over again throughout the 
years, and it either uses several of your processors or if you have two few it 
uses tried and true Linux multitasking. Seems to me with that available it 
makes no sense to debug your own coroutines.

Thanks

SteveT