> It should be emphasised that this limit hits in very specific
> circumstances. Not only you need 5 constructors nested inside each
> other, but each one should have dozens of elements. (Just for curiosity,
> did you reach that limit?)
After I've noticed that maximum depth depends on the number of sequence members I've turned to sources and saw LFIELDS_PER_FLUSH defined in lopcodes.h which is 50, so opening the new nesting level after LFIELDS_PER_FLUSH * X - 1 sequential fields (X is any positive integer) leaves them in the registers unflushed and decrease substantially the rameining nesting pool.
> I don't understand that point. Why would debugging be tough?
Because the nesting limit is data order dependent.
The case
{0, ... , 0, {0 .. , 0, {0, ... , 0, {0, ... , 0, {0, ... , 0, {0, ... , 0, {0, ... , 0}}}}}}}
will cause an error, while the case
{{{{{{{0, ... , 0}, 0, ... , 0}, 0, ... , 0}, 0, ... , 0}, 0, ... , 0}, 0, ... , 0}, 0, ... , 0}
will not.
If the table is software-generated in certain applications data order is not reproducible and will lead to the headache :-)
I realize that Lua is not used as the data exchange format, as the most it is used for configs, and the described deviation remains hidden. Maybe the warning about the guaranteed nesting depth limit will cool down the hot heads haunting for something not very common :-)
вівторок, 25 червня 2024 р. о 23:03:42 UTC+3 Roberto Ierusalimschy пише: