[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Desired Lua Features
- From: Paige DePol <lual@...>
- Date: Mon, 29 Jan 2018 10:50:16 -0600
Tim Hill <email@example.com> wrote:
>> On Jan 28, 2018, at 1:24 PM, Dirk Laurie <firstname.lastname@example.org> wrote:
>> 2. In a for statement, allow extra conditons before the 'do'.
>> for _,item in ipairs(list) if type(item)=='table' do
>> equivalent to
>> for _,item in ipairs(list) do if type(item)=='table' then
>> end end
> -1 to all of #2
> It won’t change runtime performance so far as I can see, and it appears to
> complicate the syntax for no gain other than not typing one or two extra
> keywords (“then” and “end”).
The syntax is completely optional though, if you didn't want to use it then
you wouldn't have to. Actually, adding this extension would be fairly easy
to do and I don't think it would even expand the parser by very much at all.
Sometimes a bit of syntactical sugar is nice if it helps people represent
the intent of their code better. Of course, that is always going to be a
subjective thing... one person's trash is another person's treasure. ;)