lua-users home
lua-l archive

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


On Wed, Nov 28, 2018 at 12:18 PM Sam Pagenkopf <ssaammp@gmail.com> wrote:
>
> Egor Skripturnoff:
>>
>> How to save intermediate value in this code
>> a:b.c()
>> a:b.d()
>> to rewrite it in optimized way
>> local x = a:b
>> x.c()
>> x.d()
>
> Okay, but what would you expect from this?
> a.b = a:b

Using the implementation I was alluding to, that operation would
BASICALLY be a no-op, because the new value of a.b would be a binding
object that exposes the properties of b but gets passed to methods as
if it were a. It would cause issues if you tried to then use a as a
prototype to construct a2, but in and of itself it wouldn't be an
issue.

/s/ Adam