If you are unable to make good decision between different number types you better don't write software, IMHO. How do you reason about the operations you apply to your data if you are ignorant of the possible values?
Being able to make good decisions does not guarantee you will never make a mistake. And he even explains his reasoning behind his choice and it was a justifiable decision when he made it. But I stand by what I said - if you are unable to decide between using 8 bit or 64 bit integers or a floating point type or a decimal type you should not be a professional software developer because it is really a very basic and fundamental skill.
In the web industry, which is the biggest part of the software industry by people employed, most developers use dynamically typed languages and very happily never make this "fundamental" choice. Should they all resign?
Not only web industry: in Smalltalk every integer can have unlimited number of bits. On 32-bit systems internally 31 bit is used first and with overflow it automatically starts using variable size integers... There is no need to make a choice on the number of bits... Just use integers as they are in the nature...
Dynamically typed does not mean that you don't have to think about number types - 3/2 and 3/2.0 may yield different results in dynamically typed languages.
And how many web developers don't know about or are unable to decide between different number types? JavaScript type coercion is such a mess, how could you get away without thinking about types, even though number types are usually not an issue?
Thankfully Python fixed that discrepancy about 3/2
Anyhow, I don't agree with you: I think that getting a bug years down the road due to a too small numeric type is something that the programming language itself should avoid.... not because "developers don't ought to know it", but because mistakes happen
Anyhow, even with a dynamically typed programming language like Python or Javascript you can care about the size of your numbers.
Just import the array module (in Python) or use the Int32Array/Int8Array/etc. types (in Javascript)
In what way it isn't? Just look at this beauty [1] and its consequences. But probably nobody uses the equality operator anymore because it is such a mess. Less than is even more messed up [2].
Well, your first line doesn't make sense, since the first two comparisons are using type coercion but the third isn't, so it's like saying `0 == false` but `0 !== false` how can this be? (" " != "" is the same as " " !== "")
The second line at least uses type coercion, but still you are making the wrong assumptions. true could be coerced to many strings 't', '1', 'true', 'yes', 'on', but they chose to use '1' (You may not like it but I think it's a good choice). Infinity on the other hand has not many choices when coercing it to a string I can think of '∞' (which is difficult to type), 'Infinity', and maybe 'Inf.' so I think they made a good choice here.
I'm not saying type coercion in js has no problems, but you said that it's a mess and I just think you chose the wrong examples.
That is not specifically type coercion, but the behavior of the equality (==) operator in JavaScript. Type coercion in JavaScript can be very useful, for example !!('foo') is coercive and easily understood (and has an unsurprising result). Thankfully the == operator is completely optional and has a more easily understood === (identity) correspondent, making your point less about a language and more about a specific operator within a language.
Other operators in JavaScript may behave more intuitively than ==, but I don't think you can really make a good case for JavaScript's type coercion being 'unsurprising'.
I suppose what I meant was that you point out that the coercive behavior of some operators is counter intuitive; ergo type coercion in JS is a mess. I dont think that follows because some operators behave in a coercive fashion more convenient than many other languages.
None - because === does not coerce types. Type coercion, not double-equal weirdness as such, is the gripe of the GGP. Non-transitive, inconsistent equality is nothing more than a symptom of JS's rules for implicit conversions.
Language-war disclaimer: I love javascript and everything, it's a very expressive language; but a good wodge of the tooling around it nowadays is to help people avoid things like implicit type-coercion 'surprises'.
Ruby, Python and PHP all support several types of numbers. But even if they did not this would not preclude people developing in those languages from being able of making such decisions.
I write software, and the amount of times I even have to explicitly manipulate numbers in a given week is very close to zero. Even iteration is done through iterators instead of indexes, so writing a plus sign is done pretty sparingly.
Data manipulation beyond "pull out of database" or "submit user input to database" is a lot rarer in enterprise software like this than in scientific computing. I'm not saying it's bad to be aware of it, but software is more than numbers.
I develop enterprise software, too, and I definitely think it matters there, too. You better make sure your database columns have the correct number type or you will get in trouble if your inventory numbers or monetary values start showing rounding errors.
I just wanted to address your point that enterprise software does usually not involve dealing with numbers.
When it comes to integers you are right - signed and 32 bits is a viable choice in north of 90 % of all cases. And when I wrote you should be able to make good decision about the number type to use I was already thinking of all the number types, however I did not express this well. But then I really don't see a lot of difference between being able to choose between integer, floating point and decimal types on the one hand and various integer types on the other hand.
Yeah, you're right, data types matter. Like sibling said, this was more in response to signed/unsigned or different bit sizes. We could get rid of minutiae while still allowing for broad choice when it actually matters.
I do think that the difference between Integer/Fractional is important, but honestly if you're dealing with money you should be using some Money datatype that's smart about this instead of raw numbers.
Even if you abstract away the indexes, when working with datasets that large you have to worry about whether the standard implementation makes the same class of error.
For example, using Java's binarySearch on arrays of length over 2^30 was broken until 2006[0][1].