lua-users home
lua-l archive

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


>>>>> "Sean" == Sean Conner <sean@conman.org> writes:

 >> This is one of only two places in the whole Lua codebase, and is the
 >> only library function, where __close is used (in both cases the code
 >> just sets __close = __gc).

 Sean>   Now that I think about it, why have __close at all? Why not
 Sean> have locals marked as <toclose> just call __gc upon leaving
 Sean> scope?

1) you might not want __close and __gc to do the same thing, and if you
   do want it, it's trivial to assign the same function to both

2) it would allow any object with __gc but not __close to be assigned to
   a toclose variable, and that breaks a sandbox's control over error
   handling

-- 
Andrew.