OT: 'best' dynamic language

Igor Sysoev is at rambler-co.ru
Tue Apr 22 15:19:05 MSD 2008


On Tue, Apr 22, 2008 at 12:55:17PM +0200, Manlio Perillo wrote:

> Igor Sysoev ha scritto:
> >On Tue, Apr 22, 2008 at 12:23:26PM +0200, Manlio Perillo wrote:
> >
> >>Igor Sysoev ha scritto:
> >>>On Mon, Apr 21, 2008 at 09:50:58AM +0200, Aleksandar Lazic wrote:
> >>>
> >>>>On Son 20.04.2008 15:38, Cliff Wells wrote:
> >>>>>On Mon, 2008-04-21 at 00:26 +0200, Manlio Perillo wrote:
> >>>>>
> >>>>>>I'm very interested in developing a module for lua (or io), mostly
> >>>>>>for testing the best possible integration with the Nginx event
> >>>>>>module.
> >>>>>I'd like to see Lua as a replacement/alternative for Nginx's Perl
> >>>>>module.  Unlike most dynamic languages, Lua was originally designed to
> >>>>>be embedded.  I find its syntax much cleaner than Perl and it
> >>>>>undoubtedly has a much smaller memory footprint.
> >>>>I prefer nekovm (http://www.nekovm.org/) for this ;-)
> >>>>
> >>>>Look:
> >>>>
> >>>>http://lists.motion-twin.com/pipermail/neko/2008-April/thread.html
> >>>>
> >>>>=> NGinx and NekoVM
> >>>It seems that Neko as well as Lua, perl, etc do the same in memory
> >>>allocation failure case: exit() or nothing, i.e., segfault.
> >>>
> >>From what I can see, Lua (as Python) throws an exception in case of 
> >>memory allocation failure.
> >>
> >>Python uses a statically allocated object for the Memory Error exception.
> >>
> >>Lua uses _longjmp/_setjmp, with integer representing error codes.
> >>It only calls exit if no exception handler is installed.
> >
> >Well, but what can I do in exception handler ?
> >Destroy a whole interpreter, leaving various leaks ?
> >
> 
> With Lua you can supply you allocator function.

It does not resolve the problem. The interpreter internally must test
result of EVERY function that may fail on memory allocations:

void *
interpreter_function0()
{
    p = interpreter_function1();
    if (p == NULL) {
        some rollback operations
        return NULL;
    }
}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list