Library scope #31
Description
I would be good to nail down some questions regarding the scope of this library. Specifically:
- Should it support functions added to the JS Math object in ES6?
- Should it support other useful math functions and constants?
The function Math.random()
is not supported and I think that leaving it out is uncontroversial.
On 1, the library currently supports the ES6 functions imul
and trunc
with polyfills but no others. So we have some options:
1a. Strictly no ES6. Remove imul
and trunc
1b. No changes. Leave imul
and trunc
but add no others
1c. All ES6. Add all missing functions (except random
). This would fix issue #25.
There are currently two open PRs (#19 and #21) that contribute some ES6 functions. They have been open for some time. I'm not sure why they haven't been accepted but the polyfills have some overflow issues. I recently released purescript-math-es6 which contains all ES6 functions with robust polyfills. The project purescript-math-es6-quality lets you see how well the polyfills match native values in Node.js and the browser. purescript-math-es6 could be merged into this library if full ES6 support is required.
My vote is 1c achieved by merging purescript-math-es6. But I am biased.
On 2, the library currently supports the function remainder
/%
and the value tau
which are not properties or methods of the Math object. PR #29 would add the golden ratio as another constant. Similar to 1 we have three options:
2a. Strictly Math properties and methods. Remove remainder
and tau
. Removing remainder
would be a significant breaking change
2b. No changes. Leave remainder
and tau
but reject the golden ratio and make it clear in the README that other math functions and constants will also be rejected
2c. Accept the golden ratio and update the README asking for additional math functionality
My vote here is 2b. I think the library should just reflect the JS Math object but the changes from adopting 2a
would be too painful. Perhaps we could move remainder
to Data.Number
and add depreciation warnings to remainder
and tau
so we can eventually remove them.
Thoughts?