[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua language extension for complex number and vector values
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 31 Mar 2011 08:40:05 +0200
On Thu, Mar 31, 2011 at 3:20 AM, David Manura <dm.lua@math2.org> wrote:
> you know at compile time which operations must be interpreted as
> vector operations because the lexical variables are statically typed
> as vector
Yes, although to handle full complex arithmetic you must parse such
expressions into some AST form in order to generate the real and
complex parts of the expression. A bit messy, but the performance
benefits would be worth it.[1]
It doesn't feel like something that should or needs core changes -
more like a supercharged preprocessor with MetaLua-like capabilities,
but emitting Lua code for LuaJIT, etc.[2]
'Values' like c are interesting, because they can never be first-class
values. They are a generalization of '...' and subject to the same
restrictions - can only put into tables if explicitly packed as a
table, etc. So formally they are nasty to reason about.
Although I have noted that high-performance computing and elegance are
sometimes rather orthogonal ;)
steve d.
[1] Fortran always had support for complex numbers, because in
scientific computing real numbers are mostly a special case of complex
numbers.
[2] rather like the first cfront implementations of C++ which generated C code.