proposal-extended-numeric-literals
proposal-extended-numeric-literals copied to clipboard
Extensible numeric literals for JavaScript
Why is this parallel lexical scope needed? Intuitively I'd expect extended literal suffixes to work similar to template tags, which live in the same global scope as everything else. Is...
There's already a `with` statement, taken directly from C++, which has static typing. It's not commonly used in JavaScript, mostly because of dynamic typing and the fact it's disabled in...
I propose we support Imaginary Numbers like Python. The other parts of the proposals are fine with me. let n = 1j * 1j https://stackoverflow.com/questions/8370637/complex-numbers-usage-in-python you could even support the...
Could this proposal be used to polyfill upcoming built-in features such as Decimal? Maybe via a conditional version of `with suffix`?
- `50~px`: no current syntax for the `~` operator after a number, it's also possible to use it with strings (#3): `"leo"~utf8`. You can even extend the operator to variable...
What if we used syntax like this for extended numeric literals? ```mjs import { BigDecimal, bigDecimalLiteral } from "./bigdecimal.mjs"; with literal 0d from bigDecimalLiteral; .1d + .2d === .3d; ```...
E.g.: ```javascript decorator @dimension (unit = 'px') { @numericTemplate(({ number }) => new Dimension(number, unit); } const cm = 42@dimension('cm'); // cm instanceof Dimension && cm.unit === 'cm' const px...
Following a [twitter discussion](https://twitter.com/tabatkins/status/958081049560473600), I think digit separators should consider the C++ history and not necessarily repeat it because it was contended: * wg21.link/N3499 * wg21.link/N3661 originally the digit separator...
...More specifically, when would a program's source benefit from allowing the author to write things like: - `0b01010101010101_px`, `0b01010101010101_cm`, `0b01010101010101_m`, `0b01010101010101_$` - `0x0DDBA11_px`, `0x0DDBA11_cm`, `0x0DDBA11_m`, `0x0DDBA11_$` - `0o0666_px`, `0o0666_cm`, `0o0666m`,...
We already have template literals and an extensible `Number.prototype`. The value prop here seems a bit low for a syntactic change. This works today: ```js const unit = name =>...