lua-users home
lua-l archive

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


Le 19 avril 2011 09:36, Pierre-Yves Gérardy <pygy79@gmail.com> a écrit :
> Another possible solution would be to extend the __index and
> __newindex to take more than one parameter. In the same vein __len
> could be extended to return more than one value.

Hi Pierre-Yves,

for me this solution would be ideal. It should be noted also that the
indexing on multiple values is almost mandatory to support correctly
matrices because they *are* indexed with two values.

I've already proposed this solution and it was refused (surprise :-)
). I believe that the main reason is that the indexing on multiple
values would require a modification of the VM and OPCODES (as far as I
understood). I was thinking to modify Lua myself in this sense but the
arrival of LuaJIT2 changed completely the scenario. A modification of
LuaJIT2's VM can be very delicate and complicated and in addition
LuaJIT2 is a rapidly moving target for the moment.

In general support for mathematics / numerical computations seems to
be very low in priority for Lua, this explains why you don't have
native and efficient support for matrices and complex number. For the
other side this point is not trivial, the success of fortran is
justified, among other things, for its native support for complex
number and matrices. For C the complex number support and function
covariance was added recently with C99. Native support for matrix is
absent in C but the language has many other native constructs that
make it not mandatory.

-- 
Francesco