Re: t[] = 'syntactic sugar'
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: t[] = 'syntactic sugar'
- From: Enrico Colombini <erix@...>
- Date: 2012年1月19日 13:58:26 +0100
On 19/01/2012 13.36, Leo Razoumov wrote:
t[#t+1] is more efficient. It directly translates into SETTABLE opcode
while append goes through a function call first.
Minimalistic (just for the sake of discussion):
t[+] = val //adds parsing cost
or:
t[++] = val //adds new operator too
or:
t[#+] = val //(possibly cheaper in parsing?)
For a new "table append" construct to make sense beyond syntactic sugar
(i.e. to save the +1 operation), I guess it would probably also require
a new bytecode operator; I'm not sure it would be worth it.
--
Enrico