RE: [PHP-DEV] __init magic method

2013-01-23 Thread Jared Williams
> -Original Message- > From: Pete Boere [mailto:p...@the-echoplex.net] > Sent: 22 January 2013 12:30 > To: internals@lists.php.net > Subject: [PHP-DEV] __init magic method > > Has there ever been any discussion on an __init magic method > for bootstraping static properties on class lo

RE: [PHP-DEV] __init magic method

2013-01-22 Thread Johannes Schlüter
On Tue, 2013-01-22 at 09:39 -0600, nat...@starin.biz wrote: > I am actually going to +1 this idea I thought about discussing it, but > opted out of it because classes are most often in their own file and > if you need to do some static binding you can do it at the end of the > file after the class

Re: [PHP-DEV] __init magic method

2013-01-22 Thread Marco Pivetta
auto-executed if anything else. > > Software Developer > Nathan Bruer > > -Original Message- > From: Johannes Schlüter [mailto:johan...@php.net] > Sent: Tuesday, January 22, 2013 7:04 AM > To: Pete Boere > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV]

RE: [PHP-DEV] __init magic method

2013-01-22 Thread nathan
y 22, 2013 7:04 AM To: Pete Boere Cc: internals@lists.php.net Subject: Re: [PHP-DEV] __init magic method Hi, On Tue, 2013-01-22 at 12:29 +, Pete Boere wrote: > Has there ever been any discussion on an __init magic method for > bootstraping static properties on class load? Adding an __in

Re: [PHP-DEV] __init magic method

2013-01-22 Thread Johannes Schlüter
Hi, On Tue, 2013-01-22 at 12:29 +, Pete Boere wrote: > Has there ever been any discussion on an __init magic method for > bootstraping static properties on class load? Adding an __init method as you wish will just add complexity and gain very little. What complexity am I talking about? Well l

Re: [PHP-DEV] __init magic method

2013-01-22 Thread Pete Boere
> > What's your use case for this kind of static properties? What if you make > them private/protected and use an accessor method to initialize them (and > avoid the overhead during autoloading)? > It's the overhead of repeatedly calling an accessor method which I'd prefer to avoid. -- Pete Boe

Re: [PHP-DEV] __init magic method

2013-01-22 Thread Marco Pivetta
@Pete actually, your "less than elegant" solution seems quite enough for this use case. What's your use case for this kind of static properties? What if you make them private/protected and use an accessor method to initialize them (and avoid the overhead during autoloading)? Marco Pivetta http:/