[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Better __index lookup loop detection
- From: Xmilia Hermit <xmilia.hermit@...>
- Date: Thu, 21 Jul 2022 23:28:34 +0200
Hi!
Currently loops in the __index lookup are detected by restricting the
lookup to a depth of 2000.
This can be removed by detecting loops instead of using a depth.
Using two iterators traversing the __index lookup chain. Therby one is
faster (in this case twice) as the other.
In case there is a loop the faster one will at some point catch up to
the slower one. If this happens a loop was detected and an error can be
raised.
The implementation can be found under
https://github.com/XmiliaH/lua/tree/better-index-loop-detection.
Regards,
Xmilia