lua-users home
lua-l archive

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


>I find it short to say you don't see the need. 

I'm not sure how much more I need to add. Anyway...

I find I do not have default values often in functions that I write in Lua,
or in other languages that do support default values explicitly. I'm not
sure why this is, but perhaps it's because I think default values are often
indicators of what "Writing Solid Code" calls a "candy machine interface".

Even if I did use default values a lot, the value of the proposed syntactic
sugar seems quite low - it doesn't really help reduce errors, and doesn't
increase clarity significantly(in my view, anyway).

I think the real value of such a feature comes when the programming language
or environment allows the developer to see the signature of the function
(e.g. with Visual Studio's Intellisense) - i.e. then it is a documentation
convenience to have it in the signature declaration, but Lua doesn't have
function signature declarations.

On the "default" keyword, I'm not a fan of long names for variables local to
a function; depending on the context "default" may well be a reasonable
name.

More generally, I'm also not a fan of adding more keywords/syntactic sugar
to Lua, unless there are some very compelling reasons.

Lua is mostly a "there's one way to do it" language, on the opposite end of
the spectrum from, say, Perl, where "there's more than one way to do it" is
an accepted principle. http://www.wall.org/~larry/onion/talk.html

Both approaches have value (I'm not as down on Perl as some members of this
list), but they're different, but a mixture can be confusing and complex. I
like the spare, almost austere feel of Lua's syntax, and I think it should
be sugared only very seldom.

Long enough? :)

P.