lua-users home
lua-l archive

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


I omit brackets wherever possible and don't mind commas. Opposed to brackets, commas are typeable (on a German keyboard) without pressing shift keys. And it's also more conveniently positioned. And there's just one comma but two types of brackets (opening / closing), which is also more annoying.

Am 04.03.2012 04:23 schrieb "Greg" <tghill@hotmail.com>:
> a lot of people use and like that syntactical sugar. It makes certain things
> cleaner, especially emulating named parameter calls:
> create_box { width = 2, height = 3 }
> as opposed
> tocreate_box({width = 2 height = 3})

I agree that this is a nice shortcut.  I just don't use it nearly as much as I
use commas.  In in this (contrived) function there are 13 commas.

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

My average Lua file has over 200 commas, but I only see a handful of
opportunities to use the create_box { width = 2, height = 3 } syntax.  I'm
trying to optimize by far my largest use case.

- Greg