lua-users home
lua-l archive

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


2011/3/31 David Manura <dm.lua@math2.org>:
> I don't see why this is a problem.  In the following case:
>
>  -- input
>  local a[2], b[2], c[2], 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
>
>  -- output
>  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

The problem here is that f() may want to return a complex value so it
will actually return two scalars like in "a, b = f()". The problem is
that Lua cannot know that f() returns two values (a complex number)
and it can only pick one value to perform arithmetic.

This was the example that led me understand that my proposition was
flawed... the other reason was that Mike didn't make any comment about
it ;-)

-- 
Francesco