[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: liberality of keys
- From: Coda Highland <chighland@...>
- Date: Sun, 27 May 2012 15:26:06 -0500
On Sun, May 27, 2012 at 12:18 PM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> In Lua 5.2 there is nothing to stop one giving _ENV keys which
> cannot be identifiers; for example
> _ENV[_ENV] = {_ENV = _ENV}
> But are there any circumstances in which such licence is useful?
Absolutely.
You can key into a table using another table. Since tables exhibit
reference equality, this means that you can have a table keyed by a
token that can't be synthesized; you can only get at it if you have
the One True Handle.
The fact that this doesn't have much useful application in _ENV
specifically is irrelevant.
/s/ Adam