lua-users home
lua-l archive

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


On Fri, Feb 18, 2011 at 2:34 AM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Thu, Feb 17, 2011 at 8:23 PM, Andrew Yourtchenko <ayourtch@gmail.com> wrote:
>> I thought of naming it "node.lua" but figured it's a bit too early ;-)
>
> IMHO, a big part of the hype around node.js is that everybody
> discovered that a callback-heavy framework is usable when you have
> clean anonymous functions; but the downside that everybody suffers is
> the lack of linearity in the code.  what most don't realize is that
> it's because of the lack of coroutines or continuations.

I got used to passing the functions around back a few years ago with
Ruby - and like this functionality in Lua. Continuations tend to be
hard since I have to switch gears to a rarely used abstraction :-)
(also, with callbacks I feel I more explicitly control the flow - but
maybe this is just a feeling. a bunch of continuations bring the
run-to-completion scheduler analogies (well, because it largely would
be precisely that, I think).

>
> a Lua async implementation using coroutines would get the same
> advantages without all the pain.  that would make such a project
> distinctively 'un-node'
>
> so, naming your project 'node.lua' would be selling it low  :-)

So far it was just a small experiment to see how the luajit fares and
get a feeling.

Probably so far the part I like the best in it is "setmetatable(_G, {
__index = ffi.C } )" which makes the C and Lua functions live in
better harmony while reading (and saves some typing).

The rest I'll see how will develop (maybe) on an as-needed basis. Just
felt like sharing yesterday because of the nice feeling that
ffi+luajit gives - the raw power of C and the flexibility of Lua.

cheers,
andrew