lua-users home
lua-l archive

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


On 7 April 2014 15:40, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-04-07 20:36 GMT+02:00 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>>> 3. A depressing feeling that Lua is going in a direction that
>>> is by design unsympathetic to those who know a little more
>>> mathematics than they teach you at school.
>>
>> That is ridiculous.
>
> It is ridiculous by design, in order to have something just as ridiculous
> as reason 3 for preferring removal: "A warm feeling under the heart that
> creeping featurism is being combated by removing some features."

Except that creeping featurism _is_ combated by removing features.
People are asking for features to be added and are being granted that;
to keep the language small, sometimes things have to go away. Lua is
adding important features. You might not need them, but I'll assure
you there's a lot more people out there needing to handle non-English
text (utf8 module) than to use hyperbolic functions.

I applaud the team's desire of trimming the language's edges, even
though no one will ever fully agree on which edges to trim (myself
included!).

To further contribute to the discussion, here's the result of
searching for each math.* function in Github code search (filtering
Lua code only).

math.floor 44679
math.random 27874
math.min 16661
math.abs 16297
math.max 14023
math.ceil 12714
math.sin 11376
math.pi 10818
math.cos 9802
math.sqrt 9683
math.huge 5531
math.randomseed 4531
math.atan2 4473
math.rad 3379
math.pow 3272
math.fmod 2301
math.deg 2183
math.modf 1521
math.exp 1148
math.asin 1138
math.acos 1116
math.log 975
math.frexp 878
math.atan 657
math.tan 620
math.ldexp 559
math.tanh 404
math.sinh 394
math.cosh 386
math.ifloor 0
math.type 0

This is not perfectly scientific of course but a similar error margin
should apply to every entry. There's also a baseline number coming
from repositories that implement tools that list every function in the
standard library; these are obvious when running the search on the
least-used functions. This means that the least-used functions are
even less used than the numbers suggest (see [1] for example).

math.floor's landslide victory seems to indicate that Lua 5.3's
integer division operator is going to be a hit! :)

-- Hisham

[1] https://github.com/search?l=lua&q=%22math.sinh%22&type=Code&ref=searchresults