On Thu, Aug 18, 2011 at 10:46:27PM +0200, Lorenzo Donati wrote:
I stumbled into this idea while writing a long set-like table. Wouldn't
it be nice if the follwing:
set = { a = true, b = true, [1] = true }
could be abbreviated as:
set = { ["a","b",1] = true }
Uh-oh. Bad timing. We've just been directed on another thread
to<http://en.wikipedia.org/wiki/Parkinson%27s_Law_of_Triviality>,
which refers to Wadler's Law:
the bulk of discussion on programming language design centers
around syntax (which, for purposes of the argument is considered
a solved problem), as opposed to semantics.
But to return to your point: surely this is a Lua idiom?
set = {}
for _,v in ipairs{"a","b",1} do set[v]=true end