[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Assignment in C++ like DSL
- From: Duncan Cross <duncan.cross@...>
- Date: Thu, 24 Dec 2015 20:04:41 +0000
On Thu, Dec 24, 2015 at 5:23 PM, Abhijit Nandy <abhijit.nandy@gmail.com> wrote:
> Thanks Ross, I will try that out.
>
> Is there any reason why the assignment operator cannot be overloaded in Lua?
>
> Abhijit
In Lua, assignment is actually *not* a true expression operator. It's
only a statement, which is why you can't do things like "a = b = c =
1", or "while ((a = a + 1) < 10)" like you can in other, more C-based
languages. My understanding is that keeping this strict division
between expression and statement is part of the simplicity that Lua
needs to keep its parser as fast as possible.
-Duncan