Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91413 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98278 invoked from network); 25 Feb 2016 18:17:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2016 18:17:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.215.54 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.215.54 mail-lf0-f54.google.com Received: from [209.85.215.54] ([209.85.215.54:34158] helo=mail-lf0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/43-11730-0354FC65 for ; Thu, 25 Feb 2016 13:17:21 -0500 Received: by mail-lf0-f54.google.com with SMTP id j78so38561878lfb.1 for ; Thu, 25 Feb 2016 10:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=vvrzsYk6a7aSKMsmBRCsikuaTUN0T5nbuZLfv+GXjjE=; b=TghFRRu7PKYR9ApwEn1YRKE2JsCoMRV7h9HLUpHjEaFITLOWYpFCEX5Jck6vO7PX6/ BLNyt/0YB1KSXas9pXK5UrjsnrmajGXHwJhun5PihbRpF/gatdTFNAvp5zhnkcDdW/NL A4AoQygK/SmF7hyWOrNpX3LhsxwAbMYux0CZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=vvrzsYk6a7aSKMsmBRCsikuaTUN0T5nbuZLfv+GXjjE=; b=bVsvtd5jc617T24geff1tQh5heWjH0Z8wQOUEiquh6N1HR0CDioIWg/Qk7LWRbVcXf N1qToWKdqAO/1zPyNR6arfYPLqtpSxJP5nWRfLrgEtpQR339c2GN8EklZHSfMDNHvfZ4 s9IBX1+gMrqnP5CjUWu9UmB8BZ2X41GNVl/LkyHDp4KXexEdMWkwEEY3vVHgO+ByOkj9 LTlcmx7bb9eq2cq+0E4NLE8Yqp8tkM3NVq1GA6fYoLnefVg+xhQuOBRz421KbirxVTv8 8jMnggrZC6wVsB80QplyldtwfeEdXMADRpWd+7tYMzBIBtp5nulhpD08zOX8uWtyjkmM pXWQ== X-Gm-Message-State: AG10YOQBulZbzA3Fz+zOG6BOVVFWjgpZItcYoymOEcxK83DgvxoWmq/vx1CuUeZtH5sae2PhCSoNxyw0Xy5hsQ== X-Received: by 10.25.146.145 with SMTP id u139mr17660471lfd.113.1456424236706; Thu, 25 Feb 2016 10:17:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.216.74 with HTTP; Thu, 25 Feb 2016 10:16:56 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Feb 2016 10:16:56 -0800 Message-ID: To: Dan Ackroyd Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Callable constructors From: adam@adamharvey.name (Adam Harvey) On 25 February 2016 at 08:44, Dan Ackroyd 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 =E2=80=94 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