[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua language extension for complex number and vector values
- From: David Manura <dm.lua@...>
- Date: Wed, 30 Mar 2011 21:20:38 -0400
On Tue, Mar 29, 2011 at 7:36 AM, steve donovan
> tuple A,B -> expands to local A_1,A_2,A_3,B_1,B_2,B_3
I too have been thinking about this type of solution .
On Tue, Mar 29, 2011 at 3:30 PM, Francesco Abbate
> I understood that what I proposed cannot work because in
> order to perform the right arithmetic operation the Lua VM inspect the
> TValue and there isn't any way it can figure out that the value is
> part of a vector or not.
I don't see why this is a problem. In the following case:
local a, b, c, d = ...
c = a + b * d + f()
you know at compile time which operations must be interpreted as
vector operations because the lexical variables are statically typed
as vector. The above would be translated into
local a1,a2, b1,b2, c1,c2, d = ...
local _tmp1 = f() -- assume scalar if not explicit
c1 = a1 + b1 * d + _tmp1
c2 = a2 + b2 * d + _tmp1