lua-users home
lua-l archive

Re: Thoughts on optional commas

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


> I would personally not like as it makes the syntax inconsistent, in this case
sometimes it is mandatory and
> sometimes it isn't. Consistency has a lot of benefits.
I too am a big fan of consistency. We would be more consistent (IMHO) if we
dropped the option of no parentheses from function calls. I think we could then
remove commas from the language (or at least make them optional).
function test(a, b, c)
 print "note"
 for i,v in ipairs(a) do
 b = {1, 2, 3, "boom", {4,5,6}, }
 end
 return a, b, 15, "ok"
end
could become
function test(a b c)
 print("note")
 for i v in ipairs(a) do
 b = {1 2 3 "boom" {4 5 6} }
 end
 return a b 15 "ok"
end
This feels much cleaner and consistent to me.
- Greg

AltStyle によって変換されたページ (->オリジナル) /