[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Let deprecate to-be-close variables as harmful concept
- From: Francisco Olarte <folarte@...>
- Date: Tue, 3 Oct 2023 18:22:46 +0200
On Tue, 3 Oct 2023 at 13:19, bil til <biltil52@gmail.com> wrote:
> I have one application, where RAM is sparse (only 60kB RAM total in
> microcontroller application) and I need large local string buffers in
> the range of 5kByte inside some serial receiption loop, and in this
> case I have to use <close> for these string butters in my inner loop.
> (together with invoking garbage collector). At least if I remember
> correctly. .. . Like this then all fine.
> Without <close> I had big problems with this.
Well, I have similar things, but <close> is not that needed, a pcall +
call to __close() can do it. It 's uglier, but not that difficult, and
you can wrap that in a with(to_be_closed_things, closure ) function.
That being said, that's exactly what with thingies, try with resources
or <close> are for and they make code prettier ( IMO ) and probably a
tad faster.
Francisco Olarte.