2 ms·
> It is interesting that it would be trivial for them to localize the units, it seems like they specifically didn't So, just like a good number of apps made by
by Symbiote 10y ago
> It is interesting that it would be trivial for them to localize the units, it seems like they specifically didn't
So, just like a good number of apps made by Americans for use in other countries.
- Symbiote 10y agoIncidentally, why doesn't Android provide a global units setting? 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.
- krschultz 10y agoIn general I think software engineers do a bad job with units. We shouldn't work with floating point numbers, we should work with a number class that has a value and a unit. 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.
- derefr 10y ago> we should work with a number class that has a value and a unit. 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?
- simcop2387 10y agoClosest I can come is my esoteric language I made. It's a rough clone of Frink, but diverged during development in a number of ways: http://search.cpan.org/dist/Language-Farnsworth/lib/Language/Farnsworth/Docs/Syntax.pm 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).
- Someone 10y agoBecause it gets messy very soon. To start with, you would have to pick a set of distributions that is closed under the set of operations you want to perform. 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.9m 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. 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.
- simcop2387 10y ago