runtime
runtime copied to clipboard
All numbers should just be floats
The intricacies of when a variable is an int vs a float is confusing since you don't declare the type anywhere. JS/JSON/YAML (mostly/effectively) just have a single number type.
This will fail because foos
is implicitly an int:
args: {
foos: 4
}
...
acorn run ... --foos=4.5
Numbers should just all be floats internally.
I would argue, that using floats by default is a bad choice. Floats have imprecision and thus, you specify something like: acorn run ... --foos=12378712311112331233
, and the conversion to float will create an imprecision as you can see in this snipped: https://go.dev/play/p/nkMesfzt6tW
All integers <2^53 are exactly representable as a 64-bit float (your example is ~2^60).
Above that storing numbers as "integers" still leads to hard to reproduce recipient- & value-dependent trouble. e.g. passing through JSON or in a UI (which we will have...) because JS only has "numbers" (64-bit float).
If you're dealing with numbers that big (9 quadrillion+) the only reliable way to transmit them is as strings.
I do think the parser could give you a useful error and stop you if you try though.
moving out of v0.4.0 because i dont think @ibuildthecloud will get to it in october
assigning to @ibuildthecloud because I bucket this as part of the AML work