[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Thought experiment: what would you remove from Lua
- From: Coda Highland <chighland@...>
- Date: Wed, 1 Aug 2018 13:25:06 -0500
On Wed, Aug 1, 2018 at 1:12 PM, Dibyendu Majumdar
> On 1 August 2018 at 00:10, Coda Highland <email@example.com> wrote:
>> On Tue, Jul 31, 2018 at 5:16 PM, Dibyendu Majumdar
>> <firstname.lastname@example.org> wrote:
>>> Are there features in Lua that could be removed to create a simpler language?
>>> Of course 'simpler' needs to be defined.
>>> Simpler for users?
>>> Simpler for implementors?
>>> Often these are conflicting goals.
>>> I, for instance, never use co-routines ... and I know they add a bunch
>>> of complexity both from implementation and user point of view.
>> Coroutines are one of those things that are hard to understand and you
>> can go for years without ever having a use case for them, but then one
>> day you find a need for them and they make all the difference in the
> Maybe ...
> What triggered this thought experiment was a recent talk on Ruby:
> We also have Roberto's talk on the cost of adding features to Lua:
> As someone trying to optimize Lua, I am very much aware of the
> implementation cost of some features.
> For instance:
> 1) upvalues in Lua are like pointers to stack locations.
> 2) Debug api can manipulate values on the stack
> 3) C api can mess with the stack
> All of these features are nice I am sure but, you have to pay a heavy
> price in terms of the ability to optimize code.
> I am surprised no one mentioned dropping boolean type by the way ...
Well, given that coroutines CAN be implemented in terms of other
language features, you could implement them at a higher level -- some
sort of automated source transformation at parse time so that the
community has done this for quite a while now in order to work around
lack of browser-side support, and while the generated code is really
hard to read it's definitely just mechanical.