News for hackers. Stuff that matters.
Re:1/0 = 0 by nostrademons on Friday August 10, 2018 @06:56PM (#17737293)
Real example: I'm collecting some quality signals from a corpus, most of which are some form of ratio, average, weighted average, or scaled average of counting various quantities within the documents. If the elements being counted are missing, I want the term involving that quality signal to disappear from the final ranking calculation.

Defining x / 0 = 0 gets this behavior for free, while leaving zero as an exception means it has to be caught for every single signal calculation, which is a pain when there are potentially dozens of different signals, all of which are counting different things (and have different divisors). I've actually defined a helper function to do this automatically, which also lets me change the default "null object" easily if I choose a different representation or want to apply some baseline value.

Re:1/0 = 0 by goerz on Saturday August 11, 2018 @01:26AM (#17738496)
Defining a function would seem like exactly the right thing to do! There's no problem.
Re:1/0 = 0 by nostrademons on Saturday August 11, 2018 @03:57AM (#17738820)
Module-scoped operator overloading would be really, really nice in this situation, though.
Re:1/0 = 0 by vmchale on Monday August 20, 2018 @01:23AM (#17797881)
No, it probably wouldn't, unless you were using integers. Pony still uses floats and returns NaN or Infinity or something.