Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-29 Thread Andrey O Gromov
Just updated proposal https://wiki.php.net/rfc/code_free_constructor v 0.2 Added visibility modificators syntax. Changed behavior for parameters that need to be forwarded to parent. Added “anonymous class” section. Added “Q&A, Discussion” section. Improved description of realization.

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-26 Thread Sebastian Bergmann
Am 25.01.2019 um 11:44 schrieb Nikita Popov: I think that *if* we want to add some kind of sugar of this type, then I'd strongly prefer the syntax used by Hack than the one proposed here. Agreed. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-25 Thread Rowan Collins
On Fri, 25 Jan 2019 at 15:37, Levi Morrison wrote: > > If you have any more complex of a need (such as private variables) > then I think you should write the constructor. The reason is that if > you have private variables, you need to establish a public API > contract. > Right, which is why I th

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-25 Thread Levi Morrison
On Fri, Jan 25, 2019 at 4:05 AM Nikita Popov wrote: > > On Fri, Jan 25, 2019 at 11:44 AM Nikita Popov wrote: > > > On Wed, Jan 23, 2019 at 1:33 PM Andrey O Gromov > > wrote: > > > >> Full description > >> https://wiki.php.net/rfc/code_free_constructor > >> Draft realisation > >> https://github.c

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-25 Thread Rowan Collins
On Fri, 25 Jan 2019 at 11:05, Nikita Popov wrote: > class Point { > public int $x; > public int $y; > public int $z; > } > > // (syntax just a dummy) > $origin = new Point { x = 0, y = 0, z = 0 }; > > Where the object initialization syntax ensures that all properties that > don't have

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-25 Thread Nikita Popov
On Fri, Jan 25, 2019 at 11:44 AM Nikita Popov wrote: > On Wed, Jan 23, 2019 at 1:33 PM Andrey O Gromov > wrote: > >> Full description >> https://wiki.php.net/rfc/code_free_constructor >> Draft realisation >> https://github.com/php/php-src/compare/master...rjhdby:constructor >> >> "Code free" con

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-25 Thread Nikita Popov
On Wed, Jan 23, 2019 at 1:33 PM Andrey O Gromov wrote: > Full description > https://wiki.php.net/rfc/code_free_constructor > Draft realisation > https://github.com/php/php-src/compare/master...rjhdby:constructor > > "Code free" constructor is constructor with only purpose to directly set > object

HA: Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-24 Thread Andrey O Gromov
I'm added an illustration. Maybe it more clear for understanding. https://wiki.php.net/_detail/rfc/joined.png?id=rfc%3Acode_free_constructor >> Proposed syntax >> class A($prop) extends B("BlaBla", $prop) { >> } > This looks like unobvious magic. PHP approach has traditionally been to > avoid uno

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Stanislav Malyshev
Hi! > Proposed syntax > class A($prop) extends B("BlaBla", $prop) { > } This looks like unobvious magic. PHP approach has traditionally been to avoid unobvious magic, and be explicit about what is happening. This functionality does not seem no be enabling anything different, and seems to be prett

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Levi Morrison
On Wed, Jan 23, 2019 at 8:43 AM Levi Morrison wrote: > > On Wed, Jan 23, 2019 at 6:57 AM Bruce Weirdan wrote: > > > > On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > > > > > Proposed syntax > > > class A($prop) extends B("BlaBla", $prop) { > > > } > > > > Would this work with anonymous

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Levi Morrison
On Wed, Jan 23, 2019 at 6:57 AM Bruce Weirdan wrote: > > On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > > > Proposed syntax > > class A($prop) extends B("BlaBla", $prop) { > > } > > Would this work with anonymous classes? If so, how would the syntax look like? I have the same question.

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Dan Ackroyd
On Wed, 23 Jan 2019 at 12:32, Andrey O Gromov wrote: > > Full description > https://wiki.php.net/rfc/code_free_constructor > Draft realisation > https://github.com/php/php-src/compare/master...rjhdby:constructor > If this RFC solves a big problem for you, I would strongly recommend looking at sol

HA: Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Andrey O Gromov
>> Proposed syntax >> class A($prop) extends B("BlaBla", $prop) { >> } >Would this work with anonymous classes? If so, how would the syntax look like? Currently this syntax can't be used with anonymous classes because those classes instantiated at once they declared and same syntax is used for

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Bruce Weirdan
On Wed, Jan 23, 2019 at 2:32 PM Andrey O Gromov wrote: > Proposed syntax > class A($prop) extends B("BlaBla", $prop) { > } Would this work with anonymous classes? If so, how would the syntax look like? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.ph

Re: [PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Ivan Enderlin
On 23.01.19 13:32, Andrey O Gromov wrote: Full description https://wiki.php.net/rfc/code_free_constructor Draft realisation https://github.com/php/php-src/compare/master...rjhdby:constructor "Code free" constructor is constructor with only purpose to directly set object properties from received

[PHP-DEV] Proposal fo "Code-free constructors declaration"

2019-01-23 Thread Andrey O Gromov
Full description https://wiki.php.net/rfc/code_free_constructor Draft realisation https://github.com/php/php-src/compare/master...rjhdby:constructor "Code free" constructor is constructor with only purpose to directly set object properties from received parameters and, optionally, call parent co