[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [NoW] Once more about to-be-closed variables
- From: Sean Conner <sean@...>
- Date: Tue, 2 Jul 2019 17:37:12 -0400
Um ... it's Tuesday. Shouldn't this come out tomorrow?
It was thus said that the Great Egor Skriptunoff once stated:
> 1) *About limitations.*
> Why to-be_closed variables must be initialized at the very beginning?
Because the variable is marked const and can't be updated once marked.
> Why they must be const?
I think it's to prevent the value from being lost and thus, not closed.
Remember, it's the *variable* that is marked, *NOT* the value.
> Why an error must be raised if a value doesn't have the metamethod?
I don't like this behavior either.
> Are all these limitations necessary?
I hope not. I also hope the single variable limit can be lifted so one
can do (for the poster child example for this concept):
local <toclose> file,err = io.open(filename)
It's idiotic that right now, you have to do:
local file,err = io.open(filename)
local <toclose> file = file -- 
-spc (assume there's a check of err after the first statement ... )
 This brings up a point about luacheck. Has anyone taken over the
project? I would hate to have to stop using luacheck because it
doesn't support Lua 5.4 syntax.