PHP: a fractal of bad design (fuzzy notepad)
Posted Apr 22, 2012 12:25 UTC (Sun) by
IkeTo (subscriber, #2122)
In reply to:
PHP: a fractal of bad design (fuzzy notepad) by ajf
Parent article:
PHP: a fractal of bad design (fuzzy notepad)
You're right. The following program exhibit the said behavior:
public class T {
public static void main(String[] args) {
Integer a = 1000;
int b = 1000;
Integer c = 1000;
System.out.println(a == b && b == c && a != c);
}
}
Amazingly, there is another ways to cause the said behavior using only primitive types. (See IPSC 2008 Problem C).
And yes, I just try to be humorous when I said "even Java equality is not transitive". PHP is so horribly broken that I won't even touch it with a ten feet pole.
On the other hand, if even the very well specified Java language has non-transitive equality, you can expect that most other languages have similar behavior. One thus cannot just say a language is bad because of it. Instead, one would instead say something like "PHP equality has very surprising behavior that makes it very undesirable for programmers".
(
Log in to post comments)