2 ms·
At least the Lisp guys have figured out how to write parsers and lexers by now. (They even grok lexical scoping.) I guess we can't blame PHP for preserving th
by eru 16y ago
At least the Lisp guys have figured out how to write parsers and lexers by now. (They even grok lexical scoping.)
I guess we can't blame PHP for preserving the $ in front of variable-names with all the legacy code lying around. But the following should parse in a sane language:
$width = getimagesize($filename)[0];
Adding support for this would not break legacy code. Nobody can tell me that naming all intermediate results like
$sizes = getimagesize($img);
$width = $sizes[0];
is such a preferable style, that the parser should enforce it.
By the way, this is how PHP pretends to support higher order functions:
function cube($n) {return($n * $n * $n);}
$a = array(1, 2, 3, 4, 5);
$b = array_map("cube", $a);