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.
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/
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
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
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
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
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
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
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
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
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.
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
>> 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
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
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
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
16 matches
Mail list logo