lua-users home
lua-l archive

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


On Sun, May 31, 2009 at 03:42, Javier Guerra <javier@guerrag.com> wrote:
> Cosmin Apreutesei wrote:
>> > As Roberto said.  Normally, that is a program error, like holding a
>> > pointer to a stack object that goes out of scope in C.  Don't do that.
>> >
>>
>> But that breaks garbage-collecting semantics, which assures me never
>> to have invalid pointers no matter what... IMHO this brings me back
>> down to the C-level of responsibility (watching the stack).
>
> that's how Scheme and a few other LISP dialects do.  A special form (i.e. a macro) defines a lexical scope where a resource is valid.  any exit (normal flow, exceptions, continuations-based exit, etc) releases the resource.  if you take a reference with you when exiting, it's your problem.

Thank you, now my arguments go against lisp and scheme too :)