lua-users home
lua-l archive

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


It was thus said that the Great Dibyendu Majumdar once stated:
> 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

  Only for functions called before their definition.  My gut says that
doesn't happen as often as one may think, but as always, measure.  Perhaps
look at luarocks and luacheck (two sizable Lua applications, probably a good
representation of Lua usage) and check to see how often a function is called
prior to its defintion.  

  Also, isn't Ravi a JIT?  I would think the first time through encountering
a situation, you check the return code, but on subsequent visits you may
have the information to re-JIT that part of the code.

  Again, not doing this I have no idea of the level of effort involed, I'm
just throwing out ideas here.

> > > * 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.

  At the very least, __mode should be retained since it helps guide the GC.

> Thanks for the feedback.

  You're welcome.

  -spc