Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2016-02-09 Thread Björn Larsson
Den 2016-01-08 kl. 02:24, skrev Ben Scholzen 'DASPRiD': By the way, Rasmus updated the RFC quite a bit, you guys may want to take a look at it again. On 26.09.2015 12:23, Dominic Grostate wrote: An alternative that rfc might be to add a modifier to ctor, something like. required public funct

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2016-01-07 Thread Ryan Pallas
Hi Ben and Rasmus, On Thu, Jan 7, 2016 at 6:24 PM, Ben Scholzen 'DASPRiD' wrote: > By the way, Rasmus updated the RFC quite a bit, you guys may want to take > a look at it again. > > I just have a couple questions about the rfc, but overall I think its great and I really hope it makes it into PH

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2016-01-07 Thread Ben Scholzen 'DASPRiD'
By the way, Rasmus updated the RFC quite a bit, you guys may want to take a look at it again. On 26.09.2015 12:23, Dominic Grostate wrote: An alternative that rfc might be to add a modifier to ctor, something like. required public function __construct(); A required function cannot be final, b

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-26 Thread Dominic Grostate
An alternative that rfc might be to add a modifier to ctor, something like. required public function __construct(); A required function cannot be final, because the intention is to allow it to be overridden, but it must be called by the child impl at some point. What do u think? On 26 Sep 2015 8:

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-26 Thread Stanislav Malyshev
Hi! > Since there is no reason not to call parent ctor, maybe PHP should > somehow make every class have default empty ctor, if it doesn't have > one defined already - so you can write automatically > parent::__construct() everywhere? I completely agree with you, that's why I submitted https://wi

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-26 Thread Pavel Kouřil
On Fri, Sep 25, 2015 at 11:53 PM, Stanislav Malyshev wrote: > Hi! > >> I'm thinking primarily of the benefit to base or abstract classes. For > > Both can have constructors. > >> base classes which expect certain properties be set, they are exposed to >> the danger of remaining unset if the deriv

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Stanislav Malyshev
Hi! > I'm thinking primarily of the benefit to base or abstract classes. For Both can have constructors. > base classes which expect certain properties be set, they are exposed to > the danger of remaining unset if the derived class overrides the > constructor without calling the parent. You s

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Dominic Grostate
I'm thinking primarily of the benefit to base or abstract classes. For base classes which expect certain properties be set, they are exposed to the danger of remaining unset if the derived class overrides the constructor without calling the parent. This solution is analogous to: class Foo {

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Stanislav Malyshev
Hi! > ability to set default values of properties to instances of objects or > calls to static methods or functions (expressions in general). That is what constructors are for. I.e. I can understand initializing static properties (though it gives a lot of potential for weird race conditions) but

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Dominic Grostate
Hi, I see what you mean with static properties, that would be more difficult. I can answer on non-static however. * When will $p2 be initialized, which properties can it access? - On class instantiation. It won't have access to $this, because the object won't have been created yet. It will hav

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-25 Thread Johannes Schlüter
Hi, Would be good to split complete different subjects to different threads anyways: On Wed, 2015-09-23 at 15:53 +0100, Dominic Grostate wrote: > the > ability to set default values of properties to instances of objects or > calls to static methods or functions (expressions in general). This cau

Re: [PHP-DEV] Implementing Generics, and none scalar default properties.

2015-09-23 Thread Ben Scholzen 'DASPRiD'
Hey Dominic On 23.09.2015 16:53, Dominic Grostate wrote: A couple of things that would really help me in PHP are generics and the ability to set default values of properties to instances of objects or calls to static methods or functions (expressions in general). I don't know if either of these