Re: [PHP-DEV] constructor hook

2012-09-19 Thread Kris Craig
On Wed, Sep 19, 2012 at 10:34 AM, jpauli wrote: > > On Sep 19, 2012 4:31 AM, "Kris Craig" wrote: > > > > On Tue, Sep 18, 2012 at 8:14 AM, Amaury Bouchard > wrote: > > > > > Sounds to me like aspect-oriented programming, applied to object > > > construction. > > > Take a look at: https://github.

Re: [PHP-DEV] constructor hook

2012-09-19 Thread jpauli
On Sep 19, 2012 4:31 AM, "Kris Craig" wrote: > > On Tue, Sep 18, 2012 at 8:14 AM, Amaury Bouchard wrote: > > > Sounds to me like aspect-oriented programming, applied to object > > construction. > > Take a look at: https://github.com/AOP-PHP/AOP > > > > > Yeah I wasn't aware of this, either, but I

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Kris Craig
On Tue, Sep 18, 2012 at 8:14 AM, Amaury Bouchard wrote: > Sounds to me like aspect-oriented programming, applied to object > construction. > Take a look at: https://github.com/AOP-PHP/AOP > > Yeah I wasn't aware of this, either, but I can think of several scenarios in which it'd be useful. I kn

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Rasmus Schultz
Good point - I agree. Thanks for taking the time to think about this! On Tue, Sep 18, 2012 at 12:22 PM, jpauli wrote: > On Tue, Sep 18, 2012 at 5:14 PM, Amaury Bouchard > wrote: > > Sounds to me like aspect-oriented programming, applied to object > construction. > > Take a look at: https://gith

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Ralph Schindler
This is one of the main use cases of AOP. Demonstrated by this script: setArguments(array(new Bar)); } aop_add_before('Foo->__construct()', 'doDi'); $f = new Foo; // 'instance of Bar' -ralph On 9/18/12 11:22 AM, jpauli wrote: On Tue, Sep 18, 2012 at 5:14 PM, Amaury Bouchar

Re: [PHP-DEV] constructor hook

2012-09-18 Thread jpauli
On Tue, Sep 18, 2012 at 5:14 PM, Amaury Bouchard wrote: > Sounds to me like aspect-oriented programming, applied to object construction. > Take a look at: https://github.com/AOP-PHP/AOP +1, this is the same case as AOP, but for constructor. Thus AOP may fit the need. Julien.P -- PHP Internals

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Amaury Bouchard
Sounds to me like aspect-oriented programming, applied to object construction. Take a look at: https://github.com/AOP-PHP/AOP 2012/9/18 Rasmus Schultz : > Hey, > > I'm going to make this brief, because I suspect a lot of people are going > to jump at the opportunity to cry bloody murder when I su

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Edmond [HT]
Hello Rasmus! ~~~ RS> Hey, RS> I wonder if it would make sense to have a way to globally hook into RS> __construct() - sort of like how you can hook into the autoloaders with RS> spl_autoload_register() ... RS> This could be useful for things like dependen

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Ferenc Kovacs
On Tue, Sep 18, 2012 at 3:18 PM, Kris Craig wrote: > On Tue, Sep 18, 2012 at 6:07 AM, Johannes Schlüter > wrote: > > > On Tue, 2012-09-18 at 08:19 -0400, Rasmus Schultz wrote: > > > Hey, > > > > > > I'm going to make this brief, because I suspect a lot of people are > going > > > to jump at the o

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Kris Craig
On Tue, Sep 18, 2012 at 6:07 AM, Johannes Schlüter wrote: > On Tue, 2012-09-18 at 08:19 -0400, Rasmus Schultz wrote: > > Hey, > > > > I'm going to make this brief, because I suspect a lot of people are going > > to jump at the opportunity to cry bloody murder when I suggest this. > HELP! BLOODY

Re: [PHP-DEV] constructor hook

2012-09-18 Thread Johannes Schlüter
On Tue, 2012-09-18 at 08:19 -0400, Rasmus Schultz wrote: > Hey, > > I'm going to make this brief, because I suspect a lot of people are going > to jump at the opportunity to cry bloody murder when I suggest this. > > I wonder if it would make sense to have a way to globally hook into > __construc

[PHP-DEV] constructor hook

2012-09-18 Thread Rasmus Schultz
Hey, I'm going to make this brief, because I suspect a lot of people are going to jump at the opportunity to cry bloody murder when I suggest this. I wonder if it would make sense to have a way to globally hook into __construct() - sort of like how you can hook into the autoloaders with spl_autol