[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] metalua 0.4
- From: "Leo Razoumov" <slonik.az@...>
- Date: Thu, 7 Feb 2008 18:56:46 -0500
On 2/6/08, Fabien <fleutot+lua@gmail.com> wrote:
> I'm pleased to announce the availability of metalua 0.4, at
> http://metalua.luaforge.net.
>
> Metalua is a static metaprogramming system for Lua: a system of tools
> that let you alter the compilation process in arbitrary, powerful and
> maintainable ways. For the potential first-time users of such a
> system, a description of these tools, as implemented by metalua,
> follows.
This thread has had a very useful discussion of pros-and-cons of macro
systems and use, misuse and abuse of Lisp macros (hygienic and
otherwise). To bring down level of abstraction a little bit I would
ask the following question:
How difficult is it to use MetaLua to augment Lua syntax with
Matlab/Octave matrix specific syntactic constructs.
For example, I would like to have something like that
t= {'a','b','c','d','e'}[2:4] --> {'b','c','d'} -- (index ranges)
t={1:9:3} --> {1,3,6,9} -- (inline iterative constructors)
t={1,2;
3,4} --> {{1,2}, {3,4}} -- (almost natural matrix contstructors)
c= 1+2i --> Complex number re=1, im=2
For details of Matlab/Octave syntax in all its "glory", see http://octave.org
IMHO, Lua is perfectly positioned for a numeric "glue" language because
(1) it bind very well to C/C++ (and Fortran by its C FFI)
(2) Lua interpreter is already very fast. In addition, LuaJIT can
boost its performance by 2 to 5 times
(3) Domain specific syntactic sugar can be added with MetaLua or token filters.
As far as syntax (re)usability is concerned, syntax is a matter of
convention. If a (large) group of people consciously agree to use the
same stable syntax, their code can be made reusable. Sometimes, syntax
extensions are small and almost self-explaining. Syntax has more to do
with art than with science.
Matlab's commercial success and proliferation has a lot to do with the
fact that they augmented Basic's syntax with easy to use matrix
related constructs. Their numeric libraries (LAPACK, BLAS) were quite
standard at that time and would not be enough a differentiator.
--Leo--