You have not demonstrated that using nil as intended is a performance
problem. You have demonstrated that good performance in a contrived
example where nil is used for no good reason is not easy.
Please define the meaning of "using nil as intended" and "nil is used for no good reason".
The Lua manual does not restrict the use of nil in Lua programs (except table length operator).
How do you decide when using nil is "good" and when it is "not good"?
Is this decision based on your subjective opinion?
> As I see, you have chosen the first option - to encourage everyone to use false.
I have not chosen any of those options, I just asked a question. Any I
could rephrase the question with any non-nil values.
Your question implies that a restriction on usage of nil should exist in Lua.
This corresponds to option #1.
it is not obvious at all
that your suggestion would enable much better performance than already
It is obvious from the benchmark of program #2 vs program #4 in the OP.