OT: 'best' dynamic language
Igor Sysoev
is at rambler-co.ru
Sat Apr 26 14:22:47 MSD 2008
On Sat, Apr 26, 2008 at 11:59:38AM +0200, Manlio Perillo wrote:
> Igor Sysoev ha scritto:
> >[...]
> >The problem is that interpreter MUST TEST EVERY operation result that
> >may fail on memory allocation. And it MUST return an error to all higher
> >levels, closing and freeing all allocated resources on the back way.
> >
> >The existent interpreters either do not test result in most cases (perl),
> >or simply exit(), or in best case they throw exception. Exceptions are easy
> >way to program (you not need to test most operations) and cheap way to test
> >results (for the same reason), but they may lead to socket/file
> >descriptor/etc
> >leak.
> >
>
> I understand the problem, however I think that Lua is still usable.
>
> I'm reading the source code of Lua io library, and any opened file is
> closed when reached by the gc.
>
> This means that when Nginx detects an error, it can just force a full gc
> cycle.
>
> If this still does not sounds safe, Nginx can just create a Lua state
> (interpreter) for each request, finalizing it when the request is finalized.
>
> This is both feasible and efficient (but better is one of Lua language
> developer can confirm it).
Can this per request interpreter run precompiled code, or will it compile
it on its creation ?
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list