[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table insertion [was: Lua 5.1 (work2) now available]
- From: Philippe Lhoste <PhiLho@...>
- Date: Thu, 04 Nov 2004 22:46:22 +0100
Roberto Ierusalimschy wrote:
Whatever operator is used to return the "length" of a table, it would
be nice if it also could return the length of a string.
"*" does not strike me as intuitive for an operator yielding the length
of a table. "#" would make more sense to me, but see below.
We thought about '#' first. But '*' is smaller :)
Any background, why '*' was regarded best..?
It is a common prefix operator; the character is already used in Lua;
and some other languages use it as a length operator (e.g., Icon uses it
as string length operator). And it is smaller than '#' :)
Well, as, I suppose, most C/C++ programmers, I feel uncomfortable with
#p is an interesting alternative, even if a bit more heavy (in pixel
Let see what other low Ascii characters we can use...
Actually, I suppose we can use most Lua binary operators, as long as it
is grammatically unambiguous, eg. =t.
Someone suggested ^t, we can also use $t, %t, &t (same objection as for
* for C programmers), @t.
Why not `t, if pixel fat is important?
We also have |t and ~t.
That's a lot to chose from (plus those I forgot or omitted...).
Personnally, I am partial for ~t (remind me of a script n) or `t
(lightweight) or even =t (feels semantically right...).
-- (near) Paris -- France
-- Professional programmer and amateur artist
-- For servers mangling my From and Reply-To fields,
-- please send private answers to PhiLho(a)GMX.net
-- -- -- -- -- -- -- -- -- -- -- -- -- --