On 25 February 2016 at 08:44, Dan Ackroyd <dan...@basereality.com> wrote: > I use the Auryn* DIC library. What I've wanted to do, and should be > able to do in my opinion, is this: > > $injector->delegate('FooInterface', 'FooImplementation::__construct');
I only skimmed the RFC (and am unfamiliar with Auryn beyond glancing at its documentation for about ten seconds just now), but am I right that this is equivalent to the following? $injector->delegate('FooInterface', function (...$args) { return new FooImplementation(...$args); }); If that's the case, I'm not really convinced that this is worth the syntactic sugar. I'm also somewhat concerned about conflating instantiation and method calls — although they both ultimately call a method, they're not actually the same thing, since instantiating an object does extra work at the same time. Being able to just look for "new" in code is helpful. Open to being convinced otherwise (examples from other languages would be helpful), but my initial reaction isn't really positive. Thanks, Adam -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php