lua-users home
lua-l archive

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


> The creation of a scoped variable needs to allocate memory, and therefore
> >
> it could fail without creating the scoped variable!
> >
> 
> Would it be reasonable to only allow scoped var assignment at declaration,
> and not add the var to the stack if nil?

I don't think so. As I said, the variable must be allocated before
the creation of the resource; if we create the resource and then
the variable allocation fails, the resource won't be closed. But before
the creation of the resource we cannot know whether it will be nil.

-- Roberto