3 ms·
"computation is almost free" actually triggered me. that's the java argument from 20 years ago, now we have go and rust. it implies electron is actually a sane
by nuclx 7y ago
"computation is almost free" actually triggered me. that's the java argument from 20 years ago, now we have go and rust. it implies electron is actually a sane approach to ui development.
the author is very vague about why exactly numbers don't fit in the type system, and in which languages. first class types for numbers exist in some languages. is he advocating for default overflow checks, which bloat code size?
- dragonwriter 7y ago> the author is very vague about why exactly numbers don't fit in the type system No, he’s quite specific: “hardware details such as the number of bits supported by an integer add instruction show through in the language semantics.” Now, it's also true that there are quite a lot of languages where this is not true, e.g., Scheme, Haskell (IIRC with the default numeric settings), Ruby, Python, for instance, and many more have numeric types in core language or stdlib that don't face this problem but don't make them the default for simple numeric literals.
- geocar 7y ago> the author is very vague about why exactly numbers don't fit in the type system Numbers are hard! Consider something simple: 9999999999999999.0 - 9999999999999998.0 In discussing what is Right™ we are making a choice between all the possible Good™ ways we can deal with that expression. Here are some of the most obvious: 1. atof() could fail since the string representation doesn’t match the resulting float, but then what should happen for 0.3? I've seen this only occasionally. 2. We could use a hypothetical atonumber() which uses decimal or big float or some other representation, but what does this do to performance? This gets tried a lot. 3. We can ignore the issue and blame the programmer for not constraining the input domain to that of our function. This is what most people do. I don't personally like any of these; I've seen and experienced some of the problems with each of the approaches, so I wonder if there's a Good™ fourth option (or a fifth). Maybe it's only because I have my own ideas of what a fourth option might look like that I'm not very quick to consider this a "solved" problem to the point that someone (anyone) knows the Right™ answer, but maybe it's worth you (and others!) thinking about this too. I'm extremely interested in suggestions here.
- taylodl 7y ago"computation is almost free" - don't say that around the accountant at my company responsible for paying our AWS bill!