lua-users home
lua-l archive

Re: [NoW] Once more about to-be-closed variables

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


 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 -- [1]
 -spc (assume there's a check of err after the first statement ... )
[1]	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.

AltStyle によって変換されたページ (->オリジナル) /