lua-users home
lua-l archive

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


On Wed, Oct 10, 2012 at 2:11 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Wed, Oct 10, 2012 at 1:12 PM, Tim Caswell <tim@creationix.com> wrote:
>> After starting the luvit project over a year ago, I've learned a lot
>> about lua and the ecosystem.  Recently I've decided that cloning the
>> node.js environment doesn't have as much value as I initially
>> believed.
>
> big kudos for learning and adapting to the environment!
>
>
>>     fs.readFile(filename, encoding, otherOptions)(function (err, data)
>>       if err then return handleError(err) end
>>       -- Do something with data
>>     end)
>
> this looks like futures, as seen on Scheme, some C++ libraries and
> lately in Dart.  it's a powerful primitive, and really unravels the
> nightmarish callback spaghetti of JavaScript.  But for clarity of code
> coroutines-based beats it hands-down.

What did you think of the `data = await(fs.readFile(filename))` syntax I showed?

Also there is nothing from stopping someone from wrapping the await
call inside another function.  It auto-detects what coroutine it's
running in.


>
>
>
>> LHTTP_PARSER
>>
>> This is the http_parser bindings used in luvit today broken out into
>> it's own module.  In my moonslice-luv project I have a modified
>> version of web and continuable that uses LUV and LHTTP_PARSER to make
>> super fast http servers in stock lua.
>
> interesting.  after a quick reading it seems it would be easy to use
> on any IO strategy.
>
>
>> *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.
>
>
> --
> Javier
>