Re: to-be-closed variables as resources from a library.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: to-be-closed variables as resources from a library.
- From: bil til <biltil52@...>
- Date: 2022年9月28日 09:40:43 +0200
> > And then it really would be much better, if the __close metafunction
> > is used automatically (if it exists).
>
> You have one of these, it is called __gc.
Thank you, this is interesting remark, also this sort of "competition"
between __close and __gc.
Would __gc be invoked for local variables or not?
In the Reference Manual the local variables are described in §3.2, but
their closing behaviour is a bit unclear I think. I cannot really
recognize, whether local variables are destroyed by gc, or whether
they exist on stack and are destroyed "automatically" and end of their
scope?