Math.roundUp(), an alias for Math.ceil()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Math.roundUp(), an alias for Math.ceil()

Eric Andrew Lewis
Hi there,

this is my first message to the list. Thanks for all that you do to improve  the programming language for the web!

This is probably a curious proposal that will go nowhere but I thought it'd be interesting to share a suggestion and see how it goes.

I teach introductory JavaScript. Students have a hard time remembering the method name Math.ceil(). It looks like the name "ceil" dates back to at least the C programming language, and probably earlier.

I suggest introducing Math.roundUp() as an alias for Math.ceil() to provide an easier to read and remember method name. If this makes sense, introducing Math.roundDown() might be a good alias for Math.floor() as well.

I searched for previous discussions on creating method name aliases and couldn't find one to see how the committee has made decisions about them in the past.

Thanks,
--

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Math.roundUp(), an alias for Math.ceil()

Rob Ede
Hi Eric,

From my experience, folks don’t like adding things to the spec that are very easily implemented (like aliases) in userland.
All you’d need is a `Math.roundUp = Math.ceil` to start using the code you want.

Regards,
Rob

On 4 Aug 2018, at 23:55, Eric Andrew Lewis <[hidden email]> wrote:

Hi there,

this is my first message to the list. Thanks for all that you do to improve  the programming language for the web!

This is probably a curious proposal that will go nowhere but I thought it'd be interesting to share a suggestion and see how it goes.

I teach introductory JavaScript. Students have a hard time remembering the method name Math.ceil(). It looks like the name "ceil" dates back to at least the C programming language, and probably earlier.

I suggest introducing Math.roundUp() as an alias for Math.ceil() to provide an easier to read and remember method name. If this makes sense, introducing Math.roundDown() might be a good alias for Math.floor() as well.

I searched for previous discussions on creating method name aliases and couldn't find one to see how the committee has made decisions about them in the past.

Thanks,
--

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Math.roundUp(), an alias for Math.ceil()

Sebastian Malton
It also isn't the just the C language, those are the terms for rounding in mathematics which is why they are used.

Sebastian Malton

Sent: August 4, 2018 7:04 PM
Subject: Re: Math.roundUp(), an alias for Math.ceil()

Hi Eric,

From my experience, folks don’t like adding things to the spec that are very easily implemented (like aliases) in userland.
All you’d need is a `Math.roundUp = Math.ceil` to start using the code you want.

Regards,
Rob

On 4 Aug 2018, at 23:55, Eric Andrew Lewis <[hidden email]> wrote:

Hi there,

this is my first message to the list. Thanks for all that you do to improve  the programming language for the web!

This is probably a curious proposal that will go nowhere but I thought it'd be interesting to share a suggestion and see how it goes.

I teach introductory JavaScript. Students have a hard time remembering the method name Math.ceil(). It looks like the name "ceil" dates back to at least the C programming language, and probably earlier.

I suggest introducing Math.roundUp() as an alias for Math.ceil() to provide an easier to read and remember method name. If this makes sense, introducing Math.roundDown() might be a good alias for Math.floor() as well.

I searched for previous discussions on creating method name aliases and couldn't find one to see how the committee has made decisions about them in the past.

Thanks,
--

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss