lua-users home
lua-l archive

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


Le jeu. 6 juin 2019 à 08:21, Sergey Zakharchenko <doublef.mobile@gmail.com> a écrit :
The problem is that people often need to have "trust me, I need the
variable to stay put but I also don't want to have to remember to do
something meaningful at the end of the block to it" semantics and it
seems a bit tricky to achieve. Maybe this new annotation syntax could
help?..

An annotation is not necessary, the best way to achieve it is to insert a valid reference to the object in the relevant function.

That reference is not necessarily a read access, it can be a simple "delete x" or "x:close()" or "x:free()" statement (which uses the reference, but does not necessarily perform any read access to its inner fields or value).