lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Aug 1, 2018 at 1:12 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> On 1 August 2018 at 00:10, Coda Highland <chighland@gmail.com> wrote:
>> On Tue, Jul 31, 2018 at 5:16 PM, Dibyendu Majumdar
>> <mobile@majumdar.org.uk> 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
>> world.
>>
>
> Maybe ...
>
> What triggered this thought experiment was a recent talk on Ruby:
>
> https://youtu.be/4vxIncIm2D4
>
> We also have Roberto's talk on the cost of adding features to Lua:
>
> https://youtu.be/EUvgoxBm7uc
>
> 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 ...
>
> Regards
> Dibyendu
>

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
VM/JIT/whatever doesn't have to worry about it. The Javascript
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.

/s/ Adam