3 ms·
Most programming happens in nominally typed languages where the above isn't trivially possible. To be fair that example is contrived, but you can imagine operat
by b_e_n_t_o_n 1y ago
Most programming happens in nominally typed languages where the above isn't trivially possible. To be fair that example is contrived, but you can imagine operations happening on large dicts where only a small subset of the fields are necessary.
- tsimionescu 1y agoThis is actually a relatively common example of the benefits of either polymorphism (for the a.add(b) version) or generic methods/templates. You'll actually find libraries that have a method or template function like this in C++, Java, C#, and other commonly used static languages.