Some apps that do change seem to do so based on location, but I don't often want to see miles and feet when I'm travelling in the USA. I assume most Americans travelling elsewhere would rather be given directions in miles.
Prior to working on Android & iOS I basically didn't bother with i18n. Now I never hardcode a string, it's always a reference to a string resource that is easily translated. I think this is a mindset shift brought about because the tools & libraries make it easy. The same is true for datetime formatting and unicode. We're collectively much better at supporting i18n in those areas than we were 15 years ago. I think the next step is for us to do the same but with numbers.
Not even a unit. I've always wanted a (majorly-adopted) language and platform where "Integer" or even "Number" are low-level mostly-ignored value types, and you instead work with a type that might be called (something snappier, but equivalent to) "RationalComplexPolynomialUnitedMeasurementWithPrecision".
Like, why can't my stdlib functions all take:
(-5/6±3.5 + i±1/2) km^2/s^2
...and do something sensible (stoichiometrically) with it?If you pick 'all normal distributions' as your set, that means that you can only allow addition, subtraction, and multiplication by a constant (= a normal distribution with zero variance); you won't be able to compute x^2, take a square root, compute |x|, etc. That rules out, for example, computing the variance of a set of inexactly known numbers.
To make matters worse, to do this really well, you have to track where values come from. You really want:
x = 6±3.5m
z = x - x
to have z equal to 0±0m, but x = 6±3.5m
y = 6±3.5m
z = x - y
to have z equal to 0±4.9m. Similarly, x+x should be 12±7m, and x+y should be 12±4.9mThe best you probably can do is to forget about the second issue, and do interval arithmetic. That is useful, but gives you extremely pessimistic results.
Edit: a good solution also would resolve the question of how to handle conditionals. if x > 0 could pick each of its branches according to the probability that x is larger than zero, or even execute both branches partially (whatever that would mean), according to the distribution of x.
(I'm a little hazy on exactly what distribution is being assumed, but the basic idea of x and y being different random numbers is the important thing)
In principle one could also interpret x = 6±3.5m as "x is equal to 6 + a random number taken uniformly from the rand -3.5 to 3.5" or something, and then x+y would be 12+-7, but the real world numbers this is nominally supposed to represent don't really work that way. I think this is what is mean by "The best you probably can do is to forget about the second issue, and do interval arithmetic. That is useful, but gives you extremely pessimistic results."
http://search.cpan.org/dist/Language-Farnsworth/lib/Language...
It's missing the ranged/bracketed number support, but will do the rest of that.
13:27:11 < simcop2387> farnsworth: (-5/6+3.5 + i-1/2) km^2/s^2 -> "kJ/kg" 13:27:12 < farnsworth> simcop2387: (2166.66666666666 + 1000.00000000000*I) kJ/kg
It'll auto-convert things into floats if you use them, but it's 100 digit accuracy (configurable). Development has halted, mostly because I couldn't decide how I wanted to tackle adding objects as a first class data type and had a number of issues with the parser I needed to solve to make my life saner (easy way to force a difference between a variable and unit named "kg" etc.)
I might pick it up again and try using the parser combinators in Rust and actually compile the language down instead of an interpreter (though i'd remove eval[] to do that).
It's somewhat bitrotten but it may still be interesting if you're into this sort of thing: See [1] for an example of how it looks in practice.
[1] https://github.com/haasn/units/blob/master/tests/Tests.hs
using SIUnits, SIUnits.ShortUnits
using Measurements
((-5/6±0.1) + 1im)km^2/s^2
> -833333.3333333334 ± 100000.0 + 1.0e6 ± 0.0im m²s⁻²
typeof(((-5/6±0.1) + 1im)km^2/s^2)
> SIUnits.SIQuantity{Complex{Measurements.Measurement{Float64}},2,0,-2,0,0,0,0,0,0}
In Julia.
So, just like a good number of apps made by Americans for use in other countries.