Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46098 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10424 invoked from network); 19 Nov 2009 09:10:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2009 09:10:20 -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.211.183 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.211.183 mail-yw0-f183.google.com Received: from [209.85.211.183] ([209.85.211.183:38586] helo=mail-yw0-f183.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/51-01102-A7B050B4 for ; Thu, 19 Nov 2009 04:10:19 -0500 Received: by ywh13 with SMTP id 13so2478935ywh.29 for ; Thu, 19 Nov 2009 01:10:14 -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:content-type; bh=t+yipoOQJ6gJ32rvCtVp8R6F3+w+vgmFTSNZGcyBbMU=; b=MlNS+IZYBOrwhy6SgAcSZb8pUufxi+IvoPhx2E9iZyKauouUCYeolXZrL1/qgbxrU2 nZTM5snrEV9VG2R8j3Z6lPhfJcKkN0pGqnVoCp5gPQ3qN4CWtq+SSSx7CM9Iy2UYIJYl y8evtiIZrAth6XtZ/4BfNXjfLb6oFxUrVi7c0= 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 :content-type; b=duMEAAbs1FbIXu4wDXhAWDmWYNpeuh15f/sw5c7Jgp4rJKtaTW4a4Y2LltQjMJ/2mw OZQwNqa6s8jh4PrkCWUdi//lLamx+QXeC2+D6OqZAiDvbePLkAd0XaK+8uF2w+vkPnhj FMQotV8+QSzBDdulGvIVWNqSj+tOrS4L0oC34= MIME-Version: 1.0 Received: by 10.90.16.9 with SMTP id 9mr3914464agp.11.1258621814534; Thu, 19 Nov 2009 01:10:14 -0800 (PST) In-Reply-To: <4B04F8F4.2080208@easyflirt.com> References: <4B0426A9.4000806@easyflirt.com> <4B042CBB.9070701@easyflirt.com> <4B04F8F4.2080208@easyflirt.com> Date: Thu, 19 Nov 2009 10:10:14 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016364ee7ce2974cc0478b5baab Subject: Re: [PHP-DEV] RFC: Custom Factories (SPL) From: eloybote@gmail.com (Eloy Bote Falcon) --0016364ee7ce2974cc0478b5baab Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 2009/11/19 Mathieu Suen > Eloy Bote Falcon a =E9crit : > > 2009/11/18 Mathieu Suen >> >> Etienne Kneuss a =E9crit : >>> >>> Hello, >>> >>>> On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen < >>>> mathieu.suen@easyflirt.com >>>> >>>>> 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. >>>>>> The >>>>>> idea is to add support the registration of custom factories which ar= e >>>>>> 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 >>>>>> this >>>>>> feature. In a second step I'd need to find some skilled internals >>>>>> wizard >>>>>> 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. >> > > I have tested in php 5.2 is that a feature added in 5.3? > > >> >> Reagards, >> >> Eloy Bote. >> >> > > -- > > > =95 *Mathieu Suen* | It Team | www.easyflirt.com > =95 mathieu [dot] suen [at] easyflirt [dot] com > =95 EasyFlirt - Park Nord, Les Pl=E9iades, 74370 - Metz-Tessy - FRANCE > > > =95 Pensez =E0 l'environnement, n'imprimez cet e-mail qu'en cas de r=E9el= le > n=E9cessit=E9 > > > Yes it is. Returning to the topic, I don't think that these kind of features should be implemented in the PHP core...let's focus in other interesting features lik= e traits; a new wide range of possibilities will open and the (not so) new programming paradigms like AOP or SOP could be powerfully and easily implemented by the end users. Regards, Eloy Bote. --0016364ee7ce2974cc0478b5baab--