OT: 'best' dynamic language

Manlio Perillo manlio_perillo at libero.it
Sat Apr 26 13:59:38 MSD 2008


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).



Regards   Manlio Perillo






More information about the nginx mailing list