[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thought experiment: what would you remove from Lua
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 12 Sep 2018 09:09:54 +0200
Op Wo., 12 Sep. 2018 om 00:44 het Aapo Talvensaari
<aapo.talvensaari@gmail.com> geskryf:
>
> On Wed, Aug 1, 2018 at 1:16 AM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>>
>> Are there features in Lua that could be removed to create a simpler language?
> I think I would be just fine without:
> - goto (and labels)
People will immediately start clamouring for "continue" again.
> - repeat ... until
Well yes, we don't need it if we have 'while'. But it pays Lua's debt
to Pascal. And it is more powerful than 'while', because the
termination test can refer to variable local to the loop.
> - varargs
Without that and its 'select', you cannot distinguish between
fct(x,y,nil) and fct(x,y).
> - do ... end (maybe even this could go)
Impossible. You lose 'for' and 'while'. Multi-line inputs in the
interactive interpreter. Local variables with less than file-global
scope.
But having read this far, it strikes me that you could remove 'do ..
end', both kinds of 'for', and 'while', as long as you keep "repeat
... until".