lua-users home
lua-l archive

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


Actually no-one was arguing it should go faster, merely that it should be easier to type. There are two legitimate concerns as I see it:

1) when t is a long name. Could be particularly embarrassing if you misspell it (personally I don't like long names, but hey)
	The problem is not with the operation, but with the name of the
table.  If it bothers you why don't you simply change it to a short one?

2) when t is a more complex expression, eg: f(x)[#? + 1] = value.
	The problem here is not with the append operation also.  It shouldn't
be clear/legible to separate the "more complex expression" into two small
and readable ones?  Something like: local t=f(x); t[#t+1]=value
	In both cases I think the discussion is diverging to a kind of
competition of tastes: "I prefer this" X "I prefer that" :-(

I'm always very loath to suggest or support more syntax, but how about if '#' on its on in an expression inside [] were to mean the length of the table being indexed. So you could go:

t[#+1] = value

It's pretty clear, and almost syntactically unambiguous.
	And one-character less (to use this subjective argument) than
the current (and I think unquestionably legible, clear, unambigous...):

t[#t+1] = value

	Regards,
		Tomas