Proposal: rounding floats with `~`
Pixeladed opened this issue · 7 comments
Pixeladed commented
Automatic rounding of floats to integer
E.g:
~18361.32 //compile to 18361
nmn commented
Does this syntax have an existing implementation in some language?
alongubkin commented
The ~
operator is often used for Bitwise NOT
nmn commented
@alongubkin well that would make this syntax completely confusing.
Let's avoid syntax sugar where it isn't completely obvious.
Namek commented
I totally agree, it looks confusing. There's also rounding to given point offset, like round 18361.32
to 18361.30
or 18361.00
which such operator couldn't handle.
How often do you round floats, @Pixeladed ?
Pixeladed commented
I'll close this proposal -> bad syntax
batjaa commented
if it's really necessary how about predefining a keyworad like: round(123.43)
nmn commented
round is only slightly better than Math.round
It's not worth adding extra syntax for something like that.