Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46087 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99716 invoked from network); 18 Nov 2009 17:41:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2009 17:41:31 -0000 Authentication-Results: pb1.pair.com header.from=eloybote@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=eloybote@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.192 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: eloybote@gmail.com X-Host-Fingerprint: 209.85.210.192 mail-yx0-f192.google.com Received: from [209.85.210.192] ([209.85.210.192:64479] helo=mail-yx0-f192.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/CF-16241-AC1340B4 for ; Wed, 18 Nov 2009 12:41:30 -0500 Received: by yxe30 with SMTP id 30so1473657yxe.29 for ; Wed, 18 Nov 2009 09:41:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=93KGzv5ppL3D7ycZO8y3U2oZ/cLo30Gh7/6axeruhhA=; b=gqVXzn/xQP9zKnPUoW5BmqO2iMevIRXYWmuquhXOmhUHDtXo/8pdKosvajLkUw/dSC xZfA6AQdSJ4VlMfb+Fk62FkAr+4D5bRf47SsImFVS5Avbx6zSIXMGWUEAMT0K1NE/n1J UJ5V8g5T7rhXyq0V9m0yupLFfITZF+hCs4wtg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=SP0NR6W/F5xUibckaiuGz5J9+cBKPG3UxxYh0WM7lHHnQCDmyksRj6WSAyqABmWGOy CZA5sDTYcWYfLcRVFcKu+WO87TIViB89iy5O1tFiTjy2qMgewrX4FcVFJVAp6ug97QxL Q1z+VTgILmyjnT3590EqU8Ffpb+oHXjoWPQb8= MIME-Version: 1.0 Received: by 10.91.54.22 with SMTP id g22mr1766169agk.80.1258566088052; Wed, 18 Nov 2009 09:41:28 -0800 (PST) In-Reply-To: <4B042CBB.9070701@easyflirt.com> References: <4B0426A9.4000806@easyflirt.com> <4B042CBB.9070701@easyflirt.com> Date: Wed, 18 Nov 2009 18:41:28 +0100 Message-ID: To: Mathieu Suen Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=001485f89e529adce20478a8c056 Subject: Re: [PHP-DEV] RFC: Custom Factories (SPL) From: eloybote@gmail.com (Eloy Bote Falcon) --001485f89e529adce20478a8c056 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2009/11/18 Mathieu Suen > Etienne Kneuss a =E9crit : > > Hello, >> >> On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen > >wrote: >> >> Robert Lemke a =E9crit : >>> >>> Hi folks, >>> >>>> after discussing the idea with various PHP developers I now felt safe >>>> enough that it's not a completely stupid idea to post an RFC for it. T= he >>>> idea is to add support the registration of custom factories which are >>>> responsible for instantiating certain classes. >>>> >>>> Here is the first draft of my RFC: >>>> http://wiki.php.net/rfc/customfactories >>>> >>>> I suggest that we first discuss the implications and usefulness of thi= s >>>> feature. In a second step I'd need to find some skilled internals wiza= rd >>>> who >>>> can implement it, because not being a C developer myself, all I can >>>> offer is >>>> making suggestions and fine coffee. >>>> >>>> Looking forward to hearing your comments! >>>> Robert >>>> >>>> >>>> An other way maybe to allow this: >>> >>> $email =3D new $emailClassName(); >>> >>> >>> >>> This is already allowed. >> >> Best, >> >> > > Right!! > I get confused with: > $classNamme::getInstance(); > > So you can easily inject dependency: > > class Foo { > > protected $emailer; > > public function __construct($emailClass) { > $this->emailer=3D $emailClass; > } > > public function bar() { > // $email =3D new $this->emailer(); Of course not allowed > $emailer =3D $this->emailer; > $email =3D $emailer(); > // ... > > } > } > > -- Mathieu Suen > Well, $email =3D new $this->emailer(); it's allowed too, and behaves as expected since FOO::emailer it's a string. Reagards, Eloy Bote. --001485f89e529adce20478a8c056--