|
On 2019-07-05 9:28 p.m., Philippe Verdy wrote:
Le mer. 3 juil. 2019 à 23:42, Soni "They/Them" L. <fakedme@gmail.com <mailto:fakedme@gmail.com>> a écrit :If you indent with semicolons it'll never be an issue. May be, but what horror !And don't forget that programmers frequentlly have too long lines that they need to breakSo these lines will NOT start by semicolons after the indentation.
Indeed, as such you know exactly what's a continuation and what isn't.
Such convention of using semicolones at start of lines is never seen, much less readable than at end of instructions And anyway the semicolon in Lua is neither an end of instruction or a start, but a separate no-op instruction, allowed in some contexts where other instructions are disallowed, such as after a return already "terminated" by a semicolon (so "return;;" is valid even if there are two no-op intructions, but "return;f();" is not with only the first ";" being correct) or after a goto, or after the end of a never ending loop (so "while true do... end;;" is valid, but "while true do... end;;f();" is not), or after any expression or assignment statement that always terminates by n unconditional "error".Note that if the expression unconditionally terminates by an "error", you cannot even use it in an assignment instruction (because the assignment would never occur) or in the initializer of a "local" declaration (so "local a,b = 1,error" is invalid, and neither "a" or "b" would be initialized), as well you cannot use it in a "return" statement or in a subexpression in parentheses with other trailing or leading operators.These crietria of validity of no-op ";" statement and "error" in expressions is only particlaly detected by the syntaxic parser; they are only detected by the downstream code flow analysis, but a compiler may still accept these constructs as valid and either drop silently of the extra code, or signal it to the programmer with a lint-like warning, or say that this code is most probably wrong and refuse to compile it (which is IMHO the best option).