Hi everyone, having worked a bit with anonymous classes these days, the current boilerplate is really high to inject some local context into them. So big +1 from me for the target.
On the proposed syntax, I really prefer Nikita's proposal: return new class { > private $a = $var; > private $b = $obj->prop; > private $d = $obj->prop ?? 'default'; > // ... > } > The "functional equivalent" wording in the RFC has a big drawback: it looks like the parent constructor is overridden, which would be a really nasty side effect. It may not be the case in the implementation, but the the RFC needs to be clarified IMHO. If we were to need more closure-like syntax, we may even use "use" like this: return new class use ($var, $obj) { private $a = $var; private $b = $obj->prop; private $d = $obj->prop ?? 'default'; // ... } I really hope this new syntax (which ever raises the consensus) can be ready soon :) Nicolas