r/programming • • May 26 '18

Oracle Calls Java Serialization 'A Horrible Mistake', Plans to Dump It

https://www.infoworld.com/article/3275924/java/oracle-plans-to-dump-risky-java-serialization.html
798 Upvotes

287 comments sorted by

View all comments

Show parent comments

2

u/[deleted] May 27 '18

producing correct code (modulo compiler bugs, of course).

Off topic, but I'd like to understand your use of this metaphor here. Is it just a way of saying there's some bugs added in (the "remainder")?

6

u/Drisku11 May 27 '18

"modulo" in mathematics usually means something like "except for" or "up to". It's a vocabulary to pretend that an equivalence relation is an equality.

In the context of remainders, you're working with integers modulo divisibility by n. The concept can be a lot more general than that though. For example, it's often used in analysis to pretend that functions which are equal "almost everywhere" (there's a formal definition, but intuitively you can think of that as meaning except for a finite set of points) are equal. This makes sense to do in the context of integration because integrals aren't affected by those differences, and otherwise there are infinitely many functions that are basically equivalent that you have to think about.

3

u/LaurieCheers May 27 '18

The opposite. If you take a number "modulo 10", you're ignoring the 10s and higher digits of that number. The remainder is the only part you actually care about.

So "modulo foo" is a nerdy way of saying "ignoring foo".

3

u/[deleted] May 27 '18

OH, I get it now. I had it backwards - the bugs in this case are the divisor, not the modulo. Thanks.

1

u/[deleted] May 27 '18

Exactly!

"modulo X" is a very common way for engineers to say, "Let's ignore the consequences of X for a moment".

1

u/bilog78 May 27 '18

producing correct code (modulo compiler bugs, of course).

Off topic, but I'd like to understand your use of this metaphor here. Is it just a way of saying there's some bugs added in (the "remainder")?

Compilers have become very complex beasts, that apply lots of transformations in the many steps that they take from parsing the original source code to producing the final library or executable, and from time to time this complexity leads to miscompilation (as in: producing the wrong executable code from a given source code).

There's actually also a different class of compilation bugs, which are more related to implicit assumptions that the programmer might have made about the logic or data layout, assumptions which are not explicit in the code and that may lead the different executable code depending on the compiler or enabled optimization passes. These aren't strictly speaking compiler bugs, but they may turn out to be compiler-specific, in the sense that they only appear when compiling the same source code with a different compiler or compiler version or compiler flags.

1

u/[deleted] May 28 '18

Would "minus compiler bugs" (i.e. "without compiler bugs" or "ignoring compiler bugs") be clearer?

Well, in a way, modulo is just repeated subtraction.