lua-users home
lua-l archive

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

On Sun, Aug 10, 2008 at 4:31 AM, Matthew Paul Del Buono
<> wrote:
> Before we get into the inherent problems of this question, I think it's useful to point out the simplest response: Simplicity.
> Lua has often taken the approach of simplicity over abundance of choices. Lua is a very powerful language, but you will still notice it lacks operators which may be common in other places, such as += or bitwise operations. On that note, why ask for such a case when something like:
> foo = a + b;
> if(foo == 0)
> Would compile to the same bytecode as
> if(0 == (foo = a+b))

I'm being picky rather than advocating this be considered, but
wouldn't it be able to make a slight improvement if "foo" were a
global variable, by eliminating a globals table lookup? In a similar
way that (I believe) a method call on a global foo:bar(...) is
slightly cheaper than, ...) because _G["foo"] is
internally only looked up once, not twice.