Good reminder, thanks! Implementation would indeed require support
from PHP, say:
// magic-method __decorate implies that __construct would return
$this->__decorate(func_get_args(), $f); and enforce @ as
annotation-syntax
class Dec1 {
function __decorate($args, $f) {
return $f;
}
}
Tangent:
Could PHP as a language be kept "pure" by first implementing python
decorators*, then implement annotations using a purpose-built
decorator?
@annotate(PHP-code-goes-here)
function framework_call(request) { ... }
* http://www.python.org/dev/peps/pep-0318/
--
PHP Internals - PHP Runtime