Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Eloy Bote Falcon
2009/11/19 Mathieu Suen mathieu.s...@easyflirt.com Eloy Bote Falcon a écrit : 2009/11/18 Mathieu Suen mathieu.s...@easyflirt.com Etienne Kneuss a écrit : Hello, On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen mathieu.s...@easyflirt.com wrote: Robert Lemke a écrit : Hi folks,

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Mathieu Suen
Alban a écrit : Le Thu, 19 Nov 2009 02:24:01 +, Jared Williams a écrit : -Original Message- From: Robert Lemke [mailto:rob...@typo3.org] Sent: 18 November 2009 16:07 To: internals@lists.php.net Subject: [PHP-DEV] RFC: Custom Factories (SPL) Hi folks, after discussing the idea

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Ionut G. Stan
This smells like metaclasses to me, just that in your RFC they are supposed to work on a global level, not on a per class level. Python, for example, has a magic method called `__new__`, which controls the creation of the object whenever a new class is instantiated. It actually allows you to

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Mathieu Suen
Ionut G. Stan a écrit : This smells like metaclasses to me, just that in your RFC they are supposed to work on a global level, not on a per class level. Python, for example, has a magic method called `__new__`, which controls the creation of the object whenever a new class is instantiated. It

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Ionut G. Stan
It will work, just in a very complicated way. Emailer would need to have access to some other global variables in order to resolve its dependencies. My point is that they are globals. On 11/19/2009 4:57 PM, Mathieu Suen wrote: Ionut G. Stan a écrit : This smells like metaclasses to me, just

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Ionut G. Stan
One could just as well pass an instance of Emailer to the constructor. It's the same thing, except that it's less code (and it's easier to understand in my opinion). It's a basic application of the Law of Demeter. On 11/18/2009 7:19 PM, Mathieu Suen wrote: Right!! I get confused with:

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Mathieu Suen
Ionut G. Stan a écrit : One could just as well pass an instance of Emailer to the constructor. It's the same thing, except that it's less code (and it's easier to understand in my opinion). That is type 3 IoC. It's a basic application of the Law of Demeter. I don't see the point with

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-19 Thread Alban
Le Thu, 19 Nov 2009 12:06:19 +0100, Mathieu Suen a écrit : Alban a écrit : Le Thu, 19 Nov 2009 02:24:01 +, Jared Williams a écrit : -Original Message- From: Robert Lemke [mailto:rob...@typo3.org] Sent: 18 November 2009 16:07 To: internals@lists.php.net Subject: [PHP-DEV] RFC:

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Alexey Zakhlestin
On 18.11.2009, at 19:06, Robert Lemke wrote: 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 are responsible for

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Mathieu Suen
Robert Lemke a écrit : 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 are responsible for instantiating certain classes.

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Etienne Kneuss
Hello, On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen mathieu.s...@easyflirt.comwrote: Robert Lemke a écrit : 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

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Robert Lemke
Hi Alexey, Am 18.11.2009 um 17:27 schrieb Alexey Zakhlestin: So, from the high-level point of view, you want to introduce mechanism, which would allow instantiate objects by their interface, instead of their class-name. And this mechanism should use user-provided rules for choosing

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Mathieu Suen
Etienne Kneuss a écrit : Hello, On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen mathieu.s...@easyflirt.comwrote: Robert Lemke a écrit : 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

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Robert Lemke
Hi Mathieu, Am 18.11.2009 um 18:19 schrieb Mathieu Suen: Right!! I get confused with: $classNamme::getInstance(); So you can easily inject dependency: class Foo { protected $emailer; public function __construct($emailClass) { $this-emailer= $emailClass;

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Eloy Bote Falcon
2009/11/18 Mathieu Suen mathieu.s...@easyflirt.com Etienne Kneuss a écrit : Hello, On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen mathieu.s...@easyflirt.com wrote: Robert Lemke a écrit : Hi folks, after discussing the idea with various PHP developers I now felt safe enough that it's

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Stanislav Malyshev
Hi! Here is the first draft of my RFC: http://wiki.php.net/rfc/customfactories Something I'm missing in this RFC: what's wrong with factory base class doing: public static function getInstance() { if(static::$instance === NULL) {

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread mm w
what you call factory objects are more proxy objects, please make the difference, semantics are sometimes important. anyway , what I can read this document is a bit a mess, it needs to be split by topic, your approach is really confuse. Best, On Wed, Nov 18, 2009 at 8:06 AM, Robert Lemke

RE: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Jared Williams
-Original Message- From: Robert Lemke [mailto:rob...@typo3.org] Sent: 18 November 2009 16:07 To: internals@lists.php.net Subject: [PHP-DEV] RFC: Custom Factories (SPL) Hi folks, after discussing the idea with various PHP developers I now felt safe enough that it's not a

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Alban
Le Thu, 19 Nov 2009 02:24:01 +, Jared Williams a écrit : -Original Message- From: Robert Lemke [mailto:rob...@typo3.org] Sent: 18 November 2009 16:07 To: internals@lists.php.net Subject: [PHP-DEV] RFC: Custom Factories (SPL) Hi folks, after discussing the idea with various

Re: [PHP-DEV] RFC: Custom Factories (SPL)

2009-11-18 Thread Mathieu Suen
Eloy Bote Falcon a écrit : 2009/11/18 Mathieu Suen mathieu.s...@easyflirt.com Etienne Kneuss a écrit : Hello, On Wed, Nov 18, 2009 at 5:54 PM, Mathieu Suen mathieu.s...@easyflirt.com wrote: Robert Lemke a écrit : Hi folks, after discussing the idea with various PHP developers I now