Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Martin Keckeis
Am 08.08.2013 15:12 schrieb "Matthieu Napoli" : > > Le 08/08/2013 13:11, Martin Keckeis a écrit : > >> Am 08.08.2013 12:34 schrieb "Jordi Boggiano" : >>> >>> >>> On 08.08.2013 10:34, Leigh wrote: I'm not sure what problem this is really trying to solve, the >> >> boilerplate cod

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Michael Wallner
On 8 August 2013 17:16, Leigh wrote: > On 8 August 2013 14:12, Matthieu Napoli wrote: > >> class MyClass { >> public $foo; >> protected $bar; >> >> public function __construct($this->foo, $this->bar, $baz) { >> // $this->foo and $this->bar are now set >> > > This actually feels _way_ mo

AW: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Robert Stoll
before. -Ursprüngliche Nachricht- Von: Leigh [mailto:lei...@gmail.com] Gesendet: Donnerstag, 8. August 2013 17:17 An: Matthieu Napoli Cc: internals@lists.php.net Betreff: Re: [PHP-DEV] RFC: constructor argument promotion On 8 August 2013 14:12, Matthieu Napoli wrote: > class MyCl

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Leigh
On 8 August 2013 14:12, Matthieu Napoli wrote: > class MyClass { > public $foo; > protected $bar; > > public function __construct($this->foo, $this->bar, $baz) { > // $this->foo and $this->bar are now set > This actually feels _way_ more intuitive to me, it feels like you are passing t

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Matthieu Napoli
Le 08/08/2013 13:11, Martin Keckeis a écrit : Am 08.08.2013 12:34 schrieb "Jordi Boggiano" : On 08.08.2013 10:34, Leigh wrote: I'm not sure what problem this is really trying to solve, the boilerplate code you mention is very explicit and it is very clear to the reader what is being done.

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Martin Keckeis
Am 08.08.2013 12:34 schrieb "Jordi Boggiano" : > > On 08.08.2013 10:34, Leigh wrote: > > I'm not sure what problem this is really trying to solve, the boilerplate > > code you mention is very explicit and it is very clear to the reader what > > is being done. Each property documented with its type,

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Jordi Boggiano
On 08.08.2013 10:34, Leigh wrote: > I'm not sure what problem this is really trying to solve, the boilerplate > code you mention is very explicit and it is very clear to the reader what > is being done. Each property documented with its type, purpose and > visibility in a common place for easy refe

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Leigh
On 7 August 2013 20:47, Sean Cannella wrote: > https://wiki.php.net/rfc/constructor-promotion > > What do you all think? > I'm not sure what problem this is really trying to solve, the boilerplate code you mention is very explicit and it is very clear to the reader what is being done. Each prope

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-08 Thread Lars Strojny
Hi Sean, thanks for your answers. Am 08.08.2013 um 02:54 schrieb Sean Cannella : > It does in the sense the same way as the current mode "enforces" types on > properties. That is, there's no guarantee that types will remain as > initially set, only that the values passed to the constructor must

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Hannes Magnusson
On Wed, Aug 7, 2013 at 12:47 PM, Sean Cannella wrote: > Everyone - > > Hi! Since this is my first post to this list, I'll introduce myself: > I'm an engineer who has been working on HipHop VM in New York for the last > half year or so after a long time working at Microsoft on business software >

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Stas Malyshev
Hi! > In that case, __get() would not be called, since the property is defined > on the class, just not in a traditional way. This behavior is not > unprecedented however, as implicitly created public properties follow the > same pattern: The code doing it is actually pretty explicit - you can s

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Stas Malyshev
Hi! > Type hints continue to work as is: > > class Foo { > public function __construct(public stdClass $foo, protected array $bar = > null) {} > } This is both very confusing syntax (since this would be only place in a language where public and type name can be mixed in the same construct) and

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Sean Cannella
Hi Lars, >thanks for the RFC. Two other questions additionally to what Stas askes: > > - What about class type hints and array type hints? Type hints continue to work as is: class Foo { public function __construct(public stdClass $foo, protected array $bar = null) {} } > - If type hints ar

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Sean Cannella
Hi Stas, >> https://wiki.php.net/rfc/constructor-promotion > >1. From the first glance, it doesn't seem clear how this syntax would >interact with magic methods - i.e., if you have __get, would access to >$make call it? If not, it's rather un-intuitive since the property is >not defined in the c

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Lars Strojny
Hi Sean, thanks for the RFC. Two other questions additionally to what Stas askes: - What about class type hints and array type hints? - If type hints are possible, doesn’t it look too much as real property type hinting? cu, Lars Am 07.08.2013 um 21:47 schrieb Sean Cannella : > Everyone - >

Re: [PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Stas Malyshev
Hi! > https://wiki.php.net/rfc/constructor-promotion 1. From the first glance, it doesn't seem clear how this syntax would interact with magic methods - i.e., if you have __get, would access to $make call it? If not, it's rather un-intuitive since the property is not defined in the class but magi

[PHP-DEV] RFC: constructor argument promotion

2013-08-07 Thread Sean Cannella
Everyone - Hi! Since this is my first post to this list, I'll introduce myself: I'm an engineer who has been working on HipHop VM in New York for the last half year or so after a long time working at Microsoft on business software and services in multiple hemispheres. I wanted to get the PHP co