"Sven Olsen" <email@example.com> wrote:
>> This is correct code:
>> if a then (x)(2) end
>> This isn't:
>> if a (x)(2) end
> Ok, that certainly explains why testnext() isn't the default behavior :)
> As best as I can tell, the patch implies that an implicit "then" is
> placed at the end of the maximally long complete
> _expression_ immediately following the if? So, "if (a) (x)(2) end"
> becomes an abbreviation for "if (a)(x)(2) then end"?
> That's a little dangerous, but, compared to the sorts of
> obscure parse rules people have gotten used to dealing
> with in C++, it doesn't seem that bad... Maybe the patch
> is still worth posting on the wiki, provided an appropriate
> warning about the occasional need to use an explicit "then"
> to break up potentially ambiguous sequences of expressions?
In my opinion, the patch is not useful, and should not be on the wiki.
Any incompatible change in the language should also bring significant benefits. What is the benefit here? To save typing in four letters... sometimes? The language becomes more complex. The code you write using this patch won't be compatible with existing Lua implementations.
If you are going to change Lua, then really change it. Like with Moonscript. Minor variants (to fix someone's pet peeve) don't bring any benefit to the community in the long term.