Hi everyone,
having worked a bit with anonymous classes these days, the current
boilerplate is really high to inject some local context into them.
So big +1 from me for the target.
On the proposed syntax, I really prefer Nikita's proposal:
return new class {
> private $a = $var;
> privat
Oh, I fixed it ... I think ... carry on ...
Cheers
Joe
On Wed, Apr 20, 2016 at 7:01 AM, Joe Watkins wrote:
> Can we just halt this conversation for a few days.
>
> That implementation is totally and utterly wrong, it's so obvious this
> morning ... I'm almost embarrassed.
>
> I must say that of
Can we just halt this conversation for a few days.
That implementation is totally and utterly wrong, it's so obvious this
morning ... I'm almost embarrassed.
I must say that of all the suggestions made so far for syntax, I still
prefer use().
While the idea to allow symbols and expressions is ve
I'm not sure it matters, but there is some precedent for this in
JavaScript/ES6:
function foo(bar) {
return new class {
myBar = bar;
getBar() {
return this.myBar;
}
}();
}
console.log(foo('hello').getBar()); // "hello"
(You can actually reference out
Hi Nikita,
I was thinking some more about your suggestion:
Nikita Popov wrote on 19/04/2016 15:18:
$foo = 42;
return new class {
private $bar = $foo;
public function getBar() { return $this->bar; }
}
If we allowed this, would it make sense to also allow it in named
classes? This is
Nikita Popov wrote on 19/04/2016 15:18:
I'd like to suggest an alternative syntax:
$foo = 42;
return new class {
private $bar = $foo;
public function getBar() { return $this->bar; }
}
That is, allow properties inside the anonymous class to be initialized
based on values from the surro
On 04/19/2016 05:18 PM, Nikita Popov wrote:
On Tue, Apr 19, 2016 at 3:31 PM, Joe Watkins wrote:
Morning Internals,
Please review the following RFC:
https://wiki.php.net/rfc/lexical-anon
A look at the patch from those of you that do that would be good :)
Hey Joe,
The synt
On 19/04/16 16:18, Nikita Popov wrote:
On Tue, Apr 19, 2016 at 3:31 PM, Joe Watkins wrote:
Morning Internals,
Please review the following RFC:
https://wiki.php.net/rfc/lexical-anon
A look at the patch from those of you that do that would be good :)
Hey Joe,
The syntax and
On Tue, Apr 19, 2016 at 3:31 PM, Joe Watkins wrote:
> Morning Internals,
>
> Please review the following RFC:
>
> https://wiki.php.net/rfc/lexical-anon
>
> A look at the patch from those of you that do that would be good :)
>
Hey Joe,
The syntax and semantics proposed in this RFC do