lua-users home
lua-l archive

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


My suggestion on this would be as follows:

1. Decide which functions (or parts of functions) benefit significantly from
being implemented in 'C' (or cannot be implemented in Lua).

2. Implement these in a new API analogous to lua_arith (or just extend
lua_arith).

3. Make a minimal 'C' 'math' library consisting of wrappers round the above
API.

4. Extend this minimal library with standard implementations of the
remaining functions in Lua.

IMHO this should be the pattern for all the libraries: implement in Lua
unless there is a compelling reason for 'C', in which case the functionality
ought to be in the 'C' API as well as the Lua library. For example the
'table' library only needs 'unpack' to be implemented in C and (arguably)
'sort' for performance reasons.

I've never understood why the libraries in the standard Lua distribution
have to be entirely 'C'.

A self-respecting language should "eat its own dogfood" and "take its own
snake-oil"!