I think there needs to be a "tier-0" lib that all other libs would depend upon. This is the lib that defines a common (preferably flat) vocabulary of the most basic tools. Unfortunately, getting two people to agree upon what exactly those tools are and what names to give them is usually very hard. OTOH, I find that not having this vocabulary makes writing any code very tedious as one has to reinvent all these little wheels all the time.
Here's my own "tier-0" stdlib: https://github.com/luapower/low/blob/master/low.t -- it contains symbols for both Lua and Terra runtimes (some names even overlap, like assert() and print()). We could maybe use it as a starting point to decide what we want to include? I have one for Lua too, just for comparison: https://luapower.com/glue
a dynamic array type (mine: https://github.com/luapower/dynarray) -- here we could really benefit from an __index metamethod so we can index them with a[i] instead of a(i).
a file type for i/o (using CreateFile on Windows instead of fopen so we can actually open users' files)
a perfect hash function generator for O(1) lookups on static maps (mine: https://github.com/luapower/phf) -- no more clunky external tools to generate C code for that.
I think there needs to be a "tier-0" lib that all other libs would depend upon. This is the lib that defines a common (preferably flat) vocabulary of the most basic tools. Unfortunately, getting two people to agree upon what exactly those tools are and what names to give them is usually very hard. OTOH, I find that not having this vocabulary makes writing any code very tedious as one has to reinvent all these little wheels all the time.
Here's my own "tier-0" stdlib: https://github.com/luapower/low/blob/master/low.t -- it contains symbols for both Lua and Terra runtimes (some names even overlap, like assert() and print()). We could maybe use it as a starting point to decide what we want to include? I have one for Lua too, just for comparison: https://luapower.com/glue
Possible stuff that comes to mind as tire-1 libs:
a fast hash map (with a benchmark; mine: https://github.com/luapower/khash)
a dynamic array type (mine: https://github.com/luapower/dynarray) -- here we could really benefit from an
__index
metamethod so we can index them witha[i]
instead ofa(i)
.a file type for i/o (using CreateFile on Windows instead of fopen so we can actually open users' files)
a perfect hash function generator for O(1) lookups on static maps (mine: https://github.com/luapower/phf) -- no more clunky external tools to generate C code for that.
a PRNG (mine is a port of LuaJIT's: https://github.com/luapower/random, twice as fast than calling
math.random
from Terra)