lua-users home
lua-l archive

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

2018-01-19 12:26 GMT+02:00 Elias Hogstvedt <>:

> Since all the table functions in Lua only work or make sense on tables that
> are treated as lists we simply rename _G.table to _G.list. The list object
> should __index to _G.list so it's possible to do “mylist:insert(2)”

> Now that we have no table library we can create one with functions that only
> made sense on tables instead.
>     table.get/setmetatable, table.rawget/set, table.rawequal,,
> table.rawlen, table.pairs ( ? )

> The length operator on tables would no longer work unless we set a metatable
> on the table with the length operator.

> _G.ipairs would no longer be needed and so using pairs on lists would ensure
> correct order while on tables it would not. We can also put _G.pairs in
> _G.list.pairs to allow the syntax "for i,v in mylist:pairs() do"

> The list object would be constructed with the syntax [a,b,c] instead of
> {a,b,c} and can contain any value. However list keys are strictly numbered
> and ordered.

> "mylist = table.tolist(tbl)"  -  for converting table to list if the table
> is valid.
> "mylist = []"  -  to create a dynamically sized list.
> "mylist = [1,2,3,4,nil,6]"  -  to create a list that is 6 in length.

> Var args become a list object. Because of this I think "..." should be
> replaced with @. Here are some lua examples with the old method on top.

> I believe this would simplify and make the language easier to understand.

Seven breaking changes. Not merely breaking some programs that have
worked unchanged since Lua 2.1, breaking all of them.

Whatever you call this new language of yours, please don't include the
letters L,U,A consecutively anywhere in its name.