[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.4: question about label visibility rule
- From: Albert Krewinkel <albert+lua@...>
- Date: Wed, 19 Jan 2022 13:10:18 +0100
Arnaud Delobelle <email@example.com> writes:
> In the Lua 5.4 docs it says the following.
> > A label should not be declared where a label with the same
> > name is visible, even if this other label has been declared
> > in an enclosing block.
> I have found the following test in the Lua 5.4.3 Test Suite (available
> here: http://www.lua.org/tests/), in the file goto.lua (starting line
> In this function the label ::l1:: is declared twice, once in the
> "elseif a == 4" clause and once at the end of the function. In my
> understanding, the second declaration of this label is visible at the
> point where the first declaration is made. That would contravene the
> rule I have quoted above.
I believe the cited paragraph from the docs must be read as a
recommendation rather than a rule: the label *should not* be declared,
but if people do, the behavior is still well-defined (and tested in the
test suite). RFC 2119 phrases it best:
> 4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that
> there may exist valid reasons in particular circumstances when the
> particular behavior is acceptable or even useful, but the full
> implications should be understood and the case carefully weighed
> before implementing any behavior described with this label.
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124