lua-users home
lua-l archive

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


On Sun, 25 Nov 2018 at 22:04, Sean Conner <sean@conman.org> wrote:
>   There are languages that do type inference, where from the context of the
> code it can determine the type of a variable.

Yes that is an option that I would like to persue. One problem is
whenever you have return value from a function call you don't know
what the result will be ... so at that point you have to go back to
not knowing the type

The ideal solution is to specialize functions by types. I used to
think the function should be specialized upon entry - but it may make
more sense to specialize at call site. But return values are still a
problem.

>
> > * Eliminate metamethods except for __gc.
>
>   I looked over my own code for uses of metatables.  I use them extensively
> for userdata, very rarely for tables, and not at all for the other types.
> Furthermore, there are a few methods I've repeatedly used (for both, unless
> otherwise noted):
>
>         __mode          (table)
>         __index
>         __newindex
>         __tostring      (userdata)
>         __gc
>         __len

Perhaps I should retain these. Certainly I intend to get rid of the
arithmetic operators to start with.

> > Now, I do not know how often people implement operator overloading -
> > but given some languages do not have this feature it may not be a big
> > loss.
>
>   Personally, almost never.  But I do use LPeg (a lot) and that does use
> operator overloading.  And again, for me, this would be a big loss.
>

Yes LPeg is one of the heavy users of operator overloading.

> > I personally can do without coroutines too, I am not sure how widely
> > they are used; but the trade off is that we eliminate a bunch of
> > complexity from mini Lua.
>
>   I use them.  Maybe not as often as LPeg, but in the context I use them,
> they are invaluable.  I use coroutines to implement servers.

I think it would be nice to have two VMs built-in - a full featured
one and a cut-down one, with user being able to choose the one they
want to use. But it is harder to switch between dual number type to a
single number type.


Thanks for the feedback.

Regards
Dibyendu