2 ms·
> For example, how did you accidentally get an instance of "Set" in the code path doing arithmetic on "BigInteger" instances, and why didn't that "Set" fail ear
by swatcoder 4y ago
> For example, how did you accidentally get an instance of "Set" in the code path doing arithmetic on "BigInteger" instances, and why didn't that "Set" fail earlier during the other operations that are most likely being performed on the BigInteger (parsing it from a string, doing other arithmetic on it, etc)?
Because I got it as a return value from someone else’s function, and then this was the next thing I did with it.
It’s not hard to come up with everyday examples.
- deleted 4y ago[deleted]
- jjnoakes 4y agoSo your code calls a function that is named in a way that indicates it might return a set or an integer (and its parameters make sense in both situations), then you take the return value and add() to it ambiguously, and then you do nothing else with it? You don't loop over it or query it for set membership or pass it to any functions or multiply it? This is exactly the point of the article. Extremely extremely unlikely. But if you have a real world example of this, I'm sure the article's author is interested.