PHP Sadness

Member variable definition to function call is a syntax error

$ cat Classname.php
<?php
class Classname {
  protected $property = array(
    'root_dir' => dirname(__FILE__) . "/../../"
  );
}

$ php -l Classname.php

Parse error: syntax error, unexpected '(', expecting ')' in Classname.php on line 9
Errors parsing Classname.php

...having a function call in a member variable definition is a *syntax error*. What this means is that this sort of thing is validated by a special branch in the lexer which only comprehends certain tokens, rather than (at least attempting to) do it during the compile step while stepping through a context-agnostic parse tree.

Significance: Fast Debugging

It is very important to be able to quickly debug issues in your application. When every second of downtime costs your company money, bad error messages can mean thousands of dollars in unnecessary losses and hours of wasted developer time. Languages posing to be used in large applications need to ensure that developers can quickly discern the cause of an issue.

Significance: Implications for Internals

The mere presence of this issue tends to imply some fatal flaw or unnecessary complexity at the most basic levels of the language. For example, an overly complex parser might be trying to compensate for missing functionality in the interpreter by incorrectly (and misleadingly) validating code at the syntax level, or messages without details could indicate that the internal design prohibits access to values where they should be reachable in a sane implementation.