I have to agree with Richard as a user-land developer. It looks nice, but
knowing how people can twist things I don't think I would like this feature
get implemented. It just add stuff that is crazy to debug.
Consider someone adds a property and initializes a user-land object. That
object has othe
On Sun, April 15, 2012 5:47 pm, Simon Schick wrote:
> Just to add a random thought
> When do you expect this code to be executed?
>
> class Foo {
> static public $foo = new StdClass();
> }
I may be too late to this party, but...
For what it's worth, if the non-scalar initialization in cl
mon Schick [mailto:simonsimc...@googlemail.com]
Sent: Sunday, April 15, 2012 6:47 PM
To: Dmitri Snytkine
Cc: PHP Internals
Subject: Re: [PHP-DEV] Ability to assign new object to a class property.
2012/4/13 Dmitri Snytkine :
> I always wondered why can't we do something like this in php
>
> cl
2012/4/13 Dmitri Snytkine :
> I always wondered why can't we do something like this in php
>
> class MyClass{
>
> private $storage = new ArrayObject();
>
> public function __construct($v){
> // whatever
> }
>
> // rest of class
>
> }
>
> Why can't we create a new object and assign it to property li
Hi!
> It's convenient to assign an empty array to a property in this manner.
>
> private $storage = array();
>
> So why not
> private $storage = new ArrayObject();
array is a static constant. Objects have complex behavior. So it's
better to handle this in ctor. I see no value in splitting ctor
PM
To: Anthony Ferrara
Cc: Dmitri Snytkine; PHP Internals
Subject: Re: [PHP-DEV] Ability to assign new object to a class property.
Hi!
> Just throwing this out there, but that code wouldn't be run on parse.
> It would be "queued" to run prior to the constructor on instantiation
Hi!
> Just throwing this out there, but that code wouldn't be run on parse.
> It would be "queued" to run prior to the constructor on instantiation.
Why? You have perfectly good ctor, why not use it?
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext.
Stas,
> Because the engine doesn't run code when parsing class definitions so
> defaults should be constants (otherwise would also create a lot of
> trouble for bytecode caching as object are not cacheable).
Just throwing this out there, but that code wouldn't be run on parse.
It would be "queued
Hi!
> Why can't we create a new object and assign it to property like this?
Because the engine doesn't run code when parsing class definitions so
defaults should be constants (otherwise would also create a lot of
trouble for bytecode caching as object are not cacheable).
Use ctor for complex ini
11"
>
>
> -Original Message-
> From: ekne...@gmail.com [mailto:ekne...@gmail.com] On Behalf Of Etienne Kneuss
> Sent: Friday, April 13, 2012 3:27 PM
> To: Dmitri Snytkine
> Cc: PHP Internals
> Subject: Re: [PHP-DEV] Ability to assign new object to a class prope
DEV] Ability to assign new object to a class property.
Hi,
On Fri, Apr 13, 2012 at 21:19, Dmitri Snytkine
wrote:
> I always wondered why can't we do something like this in php
>
> class MyClass{
>
> private $storage = new ArrayObject();
>
> public function __construct($v
Hi,
On Fri, Apr 13, 2012 at 21:19, Dmitri Snytkine
wrote:
> I always wondered why can't we do something like this in php
>
> class MyClass{
>
> private $storage = new ArrayObject();
>
> public function __construct($v){
> // whatever
> }
>
> // rest of class
>
> }
>
> Why can't we create a new obj
I always wondered why can't we do something like this in php
class MyClass{
private $storage = new ArrayObject();
public function __construct($v){
// whatever
}
// rest of class
}
Why can't we create a new object and assign it to property like this?
Then when a new instance of MyClass is cr
13 matches
Mail list logo