Re: [RFC] Default constructors
| From: | Dmitry Stogov | Date: | Mon, 24 Nov 2014 09:56:57 +0000 |
| Subject: | Re: [RFC] Default constructors | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79120@lists.php.net to get a copy of this message | ||
I like the last patch. I think ZEND_ACC_STATIC flag must not make any
problems.
However, I thought about one more inconsistent. Your patch works fine for
"parent::" methods but not for "grandparents::"
In the following code "default constructor" won't work.
class A {
}
class B extends A {
}
class C extends B {
function __constructor() {
A::_constructor(); // this won't work
}
}
It's not a big problem to fix implementation to support it, or may be
support for "parent::" is enough.
Anyway, it should be reflected in RFC (if this code should work or should
not).
Thanks. Dmitry.
On Fri, Nov 21, 2014 at 10:40 AM, Dmitry Stogov <dmitry@zend.com> wrote:
> thanks Stas. I'll think on next week.
>
> Dmitry.
>
> On Fri, Nov 21, 2014 at 6:59 AM, Stanislav Malyshev <smalyshev@gmail.com>
> wrote:
>
>> Hi!
>>
>> >> Additional check for ZEND_NULL_FUNCTION in DO_FCALL may be expensive.
>> >> I think it must be better to use special predefined function (see
>> >> "zend_pass_function" usage in zend_vm_def.h).
>>
>> I've made a different implementation here:
>>
>>
>> https://github.com/smalyshev/php-src/compare/php:master...smalyshev:default_ctor_func?expand=1
>>
>> which uses zend_pass_function but I had to make it static since
>> otherwise it's increase refcount for object and it doesn't seem like it
>> decrements back. So I'm not sure if it's right, what do you think?
>>
>> --
>> Stas Malyshev
>> smalyshev@gmail.com
>>
>
>