Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97318 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68464 invoked from network); 7 Dec 2016 09:51:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Dec 2016 09:51:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=netmo.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=netmo.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: netmo.php@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wm0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:38680] helo=mail-wm0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/39-11772-2BBD7485 for ; Wed, 07 Dec 2016 04:51:46 -0500 Received: by mail-wm0-f44.google.com with SMTP id f82so157845003wmf.1 for ; Wed, 07 Dec 2016 01:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=tCy4HJxM1NyK/kiUCKhOWuDrPC3/SQwbdA0mRVE2Qa8=; b=QGOTCskueHO30fYSrEgsKH32WyRcR3CChap4OUgy2ea6z5RdgS3hkKA5/6ihb2rOIg rS291GZy6fdAgNDyeGpaOU0wIDOkL15EO1IMtqSdoWJPTVhGKcXbS/lYXAB2nnkksN4L TszHLnPO7FeQ1lG9pMPaDIlzxZcbu5bBbNjSJSdBvQ3vyHOVHoIpb4BHMAHvTBIOzXjW wc9MhHms1hBhxvWqxLza+x9rbFh1JjVt/5qplvmw0wWwyU96o7PoPOWT3Xp9VQTQljtO llLwA/2YYQV++56ioE4brXTZCen+YIxj/t1HX/ZJfxJXRGO9VJGbO3c1BtEGDMUzMaX6 VmFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=tCy4HJxM1NyK/kiUCKhOWuDrPC3/SQwbdA0mRVE2Qa8=; b=GJSJcior+TYW07KHWub3vWIB9tWAdSxliLk6UDHqifHWsCWi5bCszmRyiditw7kIxF WggPYJqQFsqlpDaRcHDMdz3yps9FishGVYz9ru7VivZYOXBcoXq17eLGV6i3g+umjSjU lNMTA9ePBuUjd24NquJmtLjvYUHVed5N5yK99BZxZ22+WA94oQHoZ/MtxdLEPcHXbiON 8JtYTvDK6oh7Kkd1UteCb8fEhWcfoeSz592rwAZO5Fx8LOZYn47NAEsJLCG2Kg0xzMhl ivBiiGlDims4SjDsRTWAt/R8ibqr8jm/U/UmHwC4TRu8ZKNaCmRFLBGy0591Fx+jCdug 1KoQ== X-Gm-Message-State: AKaTC01uuUNazgqnSTHh1pGkX6/lzRXPTrvz41T8kNdaHgdozAWhCF5FAzmu4A2tcp5/7WRCGU/lPcKlIz/tNQ== X-Received: by 10.25.21.27 with SMTP id l27mt26684327lfi.163.1481104303395; Wed, 07 Dec 2016 01:51:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.83.229 with HTTP; Wed, 7 Dec 2016 01:51:42 -0800 (PST) In-Reply-To: <5726130C.9030708@telia.com> References: <5726130C.9030708@telia.com> Date: Wed, 7 Dec 2016 10:51:42 +0100 Message-ID: Cc: Joe Watkins , PHP internals , Nikita Popov Content-Type: multipart/alternative; boundary=001a113fb6bae176bc05430e77a8 Subject: Re: Fwd: [PHP-DEV] RFC: Anonymous Class Lexical Scope From: netmo.php@gmail.com (Wes) --001a113fb6bae176bc05430e77a8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable One important thing I'd like to have here is importing the "outer" $this. e.g.: public function bar(){ return new class use($this as $that){ public function test(){ return $this->that; } }; } And I dislike how this would look with NikiC's proposal: return new class{ private $that =3D $this; }; Especially because "constant expressions" could change in the future and allow operations with $this, eg: An option could be what Joe proposed `new class use($this as $that)` (which I would particularly like if it allowed any kind of expression `new class use($this->foo->baz() + 10 as $that){}`) Or introduce a scope resolution keyword that works similarly to `parent::`. E.g.: public function bar(){ $foo =3D $this->getFoo(); return new class{ private $that =3D outer::$this; private $foo =3D outer::$foo; private $fooCall =3D outer::$this->getFoo(); }; } Thoughts? 2016-05-01 16:30 GMT+02:00 Bj=C3=B6rn Larsson : > Hi, > > Nice and clear-cut RFC! One reflection is if the usage of use > to "import" variables could have an impact on a proposal > for a short form of Lambda functions in the future? > > Cheers //Bj=C3=B6rn > > PS I liked the Short Closure RFC btw. > > > Den 2016-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 about the >> confusion :) >> >> Cheers >> Joe >> >> ---------- Forwarded message ---------- >> From: Yasuo Ohgaki >> Date: Tue, Apr 26, 2016 at 9: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 for syntax, I still >>> prefer use(). >>> >> I strongly support "use()". >> It's the way PHP imports other scope variables :) >> >> Regards, >> >> -- >> Yasuo Ohgaki >> yohgaki@ohgaki.net >> >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a113fb6bae176bc05430e77a8--