lua-users home
lua-l archive

Re: Announcing moonslice luv*, and lhttp_parser

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


On Oct 10, 2012, at 11:58 PM, Tim Caswell wrote:
> On Wed, Oct 10, 2012 at 3:57 PM, Richard Hundt <richardhundt@gmail.com> wrote:
>>> 
>>>> *I know Richard Hundt beat me to the "luv" name, and one of us will
>>>> rename if it becomes a problem. Personally I think his project is
>>>> more than just libuv bindings since it adds 0mq integration and a
>>>> fancy coroutine based interface on top.
>>> 
>>> yes, please get this sorted out while both libraries are young.
>> 
>> 
>> I'm renaming mine.
>> 
>> However, ØMQ aside, why does the presence of a coroutine scheduler on top contribute to it being "more than just libuv bindings"? We have a choice between doing lua_call to call into the VM when a callback fires, or using lua_resume instead: Lua has coroutines, why not use them?
>> 
>> I guess I'm one of these guys who's trying to save the world from callback-based reactor stuff, because he believes that it leads to code that's hard to reason about; that it's inherently bad for you, and for the environment.
> 
> 
> I just now got this message in my inbox. How strange.
> 
> Richard I just realized I might sound aggressive or offensive and
> apologize. I think your project is great. I didn't realize that you
> could skip the callback entirely by doing the resume from C code. I
> had read that coroutines from C had nasty edge cases in stock Lua.
> 
> Also I'm one of those people who has written callback based code for
> years and sees nothing wrong with it. I am aware that others don't
> like it, so my continuable/futures style was my compromise.
> 
> Even if we won't be able to collaborate on the libuv bindings, I
> wonder if apps written in my "web" style will be able to run on both
> systems.
Hey, I'm not offended so easily. It's a matter of taste in the end.
I just feel strongly about it, is all :)
So no worries. I really wanted to rename it anyway. I like "Ultraviolet"
more as a name (just don't go beating me to that one, k?).
I'm not 100% clear on what you mean by "web" style. There's certainly
nothing stopping anyone from calling a Lua callback when a coroutine
wakes up from *within* the coroutine:
 function stream:on_read(callback)
 local fiber = luv.fiber.create(function()
 while true do
 local data = self:read()
 callback(data)
 end
 end)
 fiber:ready()
 self._fibers[#self._fibers + 1] = fiber -- anchor it
 end)
So sure, it should be doable creating translation layers going to or from
both approaches.
However, the reason I hacked this up is to have the Lego to build an actor
system with, but with I/O operations which play along nicely, so no huge
interest in building a web stack with it at the moment. Having said that,
I'm giving the httpd thing a shot, but mainly to force some modularity into
the code.
Cheers,
Richard

AltStyle によって変換されたページ (->オリジナル) /