Re: [RFC][Vote announcement] Arbitrary static variable initializers
| From: | Ilija Tovilo | Date: | Fri, 17 Mar 2023 13:32:43 +0000 |
| Subject: | Re: [RFC][Vote announcement] Arbitrary static variable initializers | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119738@lists.php.net to get a copy of this message | ||
Hi Tim
> Isn't the destructor+exception example misleading? In that case the
> initial value of '$x' is constant, thus it should always be known to
> reflection, no?
>
> Should the example look like this:
>
> > function foo($y) {
> > $x = new Foo();
> > static $x = $y;
> > }
> >
> > try {
> > foo(42);
> > } catch (Exception) {}
>
> ?
Yes, your example makes more sense. In my old example the value of the
static variable was already assigned so didn't prove the point it was
trying to make. I adjusted the example in the RFC.
Thanks!