Feature Request: K, M, B numerical suffixes for thousands, millions, billions
- Dominant language
- Jsonnet
- Stars
- 7.6k
- Forks
- 475
- PR merge metrics
- No merged PRs in 30d
Description
I've always wished I could write this:
```jsonnet
{
xScale: 15M,
yScale: 100K,
zScale: 2.5M,
}
```
Instead of this:
```jsonnet
{
xScale: 15000000,
yScale: 100000,
zScale: 2500000,
}
```
It's just difficult to read, especially when there's more numbers. I have to stop and think kind of hard and look at the numbers carefully, and count the digits to make sure I'm not making a mistake.
Could do this:
```jsonnet
{
xScale: 15 * 1e6,
yScale: 100 * 1000,
zScale: 2.5 * 1e6,
}
```
But it's so verbose that I'd forget to use it.
It would be amazing if we could write numbers as simply as `100K`. I understand how this feature request might seem a little radical, but I think the purpose of the language is to describe information, and the feature scope of being able to describe information as `100K` is not all that different from `100 * 1000`.
Reasons this could work:
- It's forward compatible and wouldn't break any existing Jsonnet
- No ambiguity or parsing problems
Contributor guide
Assessment
This issue has not been assessed yet.