Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-12-29 Thread Nicolas Grekas
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

Re: Fwd: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-12-07 Thread Michał Brzuchalski
16-04-26 kl. 10:25, skrev Joe Watkins: > > > >> Morning internals, > >> > >> Just to be clear, the implementation is now in good shape, the > >> discussion may continue. > >> > >> Attached is message from a confused contributor ... sorry abou

Re: Fwd: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-12-07 Thread Wes
shape, the >> discussion may continue. >> >> Attached is message from a confused contributor ... sorry about the >> confusion :) >> >> Cheers >> Joe >> >> -- Forwarded message -- >> From: Yasuo Ohgaki >> Date: Tue,

Re: Fwd: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-05-01 Thread Björn Larsson
ubject: Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope To: Joe Watkins Hi Joe, Since you seem to pause this RFC activity for now, I'm sending this mail only to you. On Wed, Apr 20, 2016 at 3:01 PM, Joe Watkins wrote: I must say that of all the suggestions made so far for syntax, I s

Fwd: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-26 Thread Joe Watkins
:13 AM Subject: Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope To: Joe Watkins Hi Joe, Since you seem to pause this RFC activity for now, I'm sending this mail only to you. On Wed, Apr 20, 2016 at 3:01 PM, Joe Watkins wrote: > > I must say that of all the suggestions made so far fo

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Joe Watkins
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Joe Watkins
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Jesse Schalken
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Rowan Collins
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Rowan Collins
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Dmitry Stogov
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Ivan Enderlin
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

Re: [PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Nikita Popov
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

[PHP-DEV] RFC: Anonymous Class Lexical Scope

2016-04-19 Thread Joe Watkins
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 :) Cheers Joe