lua-users home
lua-l archive

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


On 4 April 2014 21:08, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
It is more a question of principles :)

In the old days (C89), it was easier to draw the line. Many functions in
the C math library seem useful and familiar (exp, sin, cos, tan, etc.);
even if there were a few not that common (like the hyperbolic ones), they
were only a few, and so the simplest thing to do was to add them all
to Lua's math lib.

Now, with C99, things are much more complex. First, there are many
more extra functions (not only in math.h but also those in fenv.h and
probably some others). Second, they are not available in all platforms
(our target is still C89, as much as possible). If we are to support
them all, sizes get larger and portability suffers. On the other hand,
if we do not add them all, where is the line? Should we keep the line
that C drawn many years ago and does not use any more? Is there any good
logic in having sinh but not asinh, isnormal, isinf, feraiseexcept,
expm1, log1p, hypot, cbrt, scalbn, and dozens more? All of them are
useful, but we must always keep in mind the bloating rule.

So, maybe a better line would be to keep the basic functions (roughly
what we learn in high school), and leave all those more advanced
functions to an external library (such as mathx).

There may be another approach that serves everybody.  Adopt the Linux kernel model.

In this model there would be a Lua language kernel.  It would be the Lua language (obviously) and the absolute minimum set of features necessary for implementation of that language.  Everything else (including much of the functionality on strings, lists, math, debug, etc.) would be farmed out to third-party (even if "blessed" third-party) libraries.

In this model there would also be Lua "distros" that bundle the Lua language kernel together with various suites of external libraries.  This way people who want to use Lua as an application-level development language can download and install a bloated, but user-friendly, distro (the Ubuntu of Lua distros if you will) that has everything included all at once.  Others who want something that starts small but can be easily extended would use a distro that is basically Lua + basic libraries + LuaRocks (or whatever other package manager is selected).  Finally the ricers could use a distro that is the same as the previous one, but makes you rebuild everything so the final product is perceived as somehow faster (the Gentoo of Lua distros).

--
"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.