[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: David Jones <drj@...>
- Date: Tue, 12 Sep 2006 11:29:06 +0100
On 12 Sep 2006, at 10:23, Paul Hudson wrote:
I'm with some of the other posters.
t = value
does not clearly say "append value to t" to me.
If we really need
t[#t+1] = value
to go faster, then the parser could be changed to recognise it as a
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
1) when t is a long name. Could be particularly embarrassing if you
misspell it (personally I don't like long names, but hey)
2) when t is a more complex expression, eg: f(x)[#? + 1] = value.
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.