Where all of this goes wrong is when I think of tables and up values. If you said that default arguments must always be literals, that *might* solve something. it gets hairy when you contemplate:
a = function(arg1 = 3, arg2 = {"first value", x = d, } or old_value or error("arg2 is required"))
What happens if arg2 is set, but the first value and/or x is not set? Are we saying, if no table, put in these defaults and if there is a table, don't put any defaults in, or fill in the missing defaults? Where is the boundary of defaults? Is it enough to just say that defaults are not recursive and that if anything is provided, than the entire default argument is discarded?
There are two topics that keep getting brought up and I think that it's repeated because there is a genuine need to clean up some common and tedious idioms. First is the frequent:
local table, string, etc = table, string, etc
second this one, which is to eliminate:
a = function(arg1, arg2)
arg1= arg1 or 3,
arg2 = arg2 or {"first value", x=d} or old_value or error("arg2 is required")
I think that the most compelling case is that there is no equivalent assignment syntax to the "lone table argument" calling syntax. If default arguments were allowed only for the "lone table argument" variety, this would be very welcomed and to my thinking, would be a "Lua amount of sugar." Something like:
a=function{arg1 = arg 2 = {(as before)} or (as before)}
assert(type(arg) == "table", "The only way to see this is if the user passes in a non-table as the first argument")
--or alternately
assert(type(({...})[1] == "table", (as before))
The only reason that I think the former might be better is because it distinguishes between the normal meaning of "..." (unknown number and type of arguments) and the fact that we really do expect a table as the first argument, in this case.
Okay, I know that others are tired of this topic. I'd only remind the annoyed that perhaps it is a sign that there is an improvement in simplicity to be found somewhere in these areas of interest.
-Andrew