note 76174 deleted from language.operators.comparison by colder

From: Date: Tue, 03 Jul 2007 21:46:54 +0000
Subject: note 76174 deleted from language.operators.comparison by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128209@lists.php.net to get a copy of this message
Note Submitter: rofthorax at gmail dot com ---- The truth table according to self-deceiving PHP language developers: $a = "1hwio123"; $b = "1hwio123"; $a == $b is true $a = "12345"; $a == $b is false; $b = 12345; $a == $b is false; $b = 12345; $a == $b is true; If PHP is an interpreter, surely it can make sound judgement about operands before comparing them, like if both operands contain numbers and no letters, reduce both operands to integer types before comparing. But if at least one operand contains letters, type cast both operands to strings.. Why is this not logical? The intepreter has the ability where a compiler does not.. Is this decision made in the interest of making PHP code compileable? What can't you just place a flag in the compiler to allow developers to treat comparisons as special cases that need to be interpretted at runtime, vesus solving the problem at compile time.. Why should those of us using interpreters be punished by the limitations of what can and can't be compiled to something that supposedly will run faster.. What is 15% speed savings to having perceptively correct code?

« previous php.notes (#128209) next »