lua-users home
lua-l archive

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


It was thus said that the Great Marc Balmer once stated:
> When a variable is marked as to-be-closed with the <close> tag and it goes
> out of scope, the __close metamethod is called.
> 
> What impact would calling a metamethod have, that is called when a
> variable goes out of scope and that has said metamethod defined?  Would
> the check for the presence of such a metamethod already introduce an
> inacceptable overhead?
> 
> I am thinking of something along e.g.  __scope(), to be called when a
> variable goes out of scope?

  There were several such proposals in 2019 for this.  From my notes, the
following proposals were made:

        __scope_exit
        __escape
        __rip
        __descope
        __enscope
        __notinuse
        __not_in_use
        __done
        __gone
        __dead
        __deassign
        __on_scope_exit

  I've yet to go back and find references to individual threads about them.

  -spc