> Or are you talking about some kind of try/finally syntax in Lua, where
> finally would release resources?
Latter.
I do not think this or that syntax should be impossible because of an implementation detail; the Lua authors control all the details, so I am pretty sure they could find a way.
However, in the earlier threads that I mentioned I made another (but fairly similar) proposal for a syntax where the user would have to request this kind of explicit finalization, which would also be scoped.
I have since come to the conclusion that this will not solve the problem in a good way, because the user of a "costly" userdatum might be ignorant of the need to do so. What I prefer is a way to mark a userdatum in that way independently of scoping, and this should be available to library writers (at a minimum; I am yet to make up my mind about users).