OT: 'best' dynamic language

Manlio Perillo manlio_perillo at libero.it
Sat Apr 26 15:25:03 MSD 2008


Manlio Perillo ha scritto:
> 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.
> 

By the way, I'm reading the source code for the NekoVM `file` library, 
and it *seems* that an opened file object must be explicitly closed, it 
is not garbage collected.

Moreover, this piece of code (gc_alloc_block function in vm/gc.c) is 
quite impressive:

#define ASSERT()		*(char*)NULL = 0

...

p = malloc(sizeof(gc_page));
if( p == NULL )
     ASSERT();





Another unhandled memory error is in vm/context.c:

_context *context_new() {
	_context *ctx = malloc(sizeof(_context));
	pthread_key_create( &ctx->key, NULL );
	return ctx;
}


So, unless I'm wrong, NekoVM does seems to meets Igor requirements.

 > [...]



Regards  Manlio Perillo





More information about the nginx mailing list