Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57458 invoked from network); 22 Sep 2015 15:36:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2015 15:36:37 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.46 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.46 mail-vk0-f46.google.com Received: from [209.85.213.46] ([209.85.213.46:32815] helo=mail-vk0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CC/BD-56639-28571065 for ; Tue, 22 Sep 2015 11:36:36 -0400 Received: by vkgd64 with SMTP id d64so9014882vkg.0 for ; Tue, 22 Sep 2015 08:36:32 -0700 (PDT) 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:date :message-id:subject:from:to:cc:content-type; bh=L3Ope7lVsANr/0ELBGGyG/fIIWeUwPfhovJAek6s/KM=; b=GCh0DyswMrCbHqtoOCzuYzRLSmn14NiQizmmEDZZLOd1ywIroDo9RPBrtz/C2LRy4g Myu1SabHVjuvg9Ka2enZ7ttPS5fmYa4ImZTdsfgNDbu4r/cO1DxI7w59eVqYqIPJy5wm xTgcEHr3vD2OB7YLnurFNH2WNYD1sOd3+XHyEmT1Ub6fPjgtuLh7coITdDnkN/B5lYWK S4YoKdRQRjV+cmuuw8WE2PqvmFBnuPus0Z8oAjjtRrkBbkcuRueepTK0kMMz95QIzVYs MBOsvwlUy5Z7GFBO9+gBsOvNZHgQstGS1CpnnNqZRyW7PnLQu8nnKsXbO9qMKrJfJoGa WSqA== X-Gm-Message-State: ALoCoQnlDluRffZpPJuspEmyM5jCNzXY3wvr/1M9iwbKErfVS8E78/DquIieH2ZM76u90knJdWjr50G5JOgjbvYRSB93cUhkFcXFfQ/SyxY6EbF6vbhs9iBiqwIa05eiBtA/yNuZsqScIxmD0wtD4quHbrhNbwb13k7wePyVl0PbooB9xfOl3+g= MIME-Version: 1.0 X-Received: by 10.31.9.212 with SMTP id 203mr18820653vkj.74.1442936192294; Tue, 22 Sep 2015 08:36:32 -0700 (PDT) Received: by 10.103.24.5 with HTTP; Tue, 22 Sep 2015 08:36:32 -0700 (PDT) In-Reply-To: References: Date: Tue, 22 Sep 2015 18:36:32 +0300 Message-ID: To: Joe Watkins Cc: Bob Weinand , PHP internals Content-Type: multipart/alternative; boundary=001a11450f402d02b5052057c389 Subject: Re: [PHP-DEV] [RFC] [VOTE] Short Closures From: dmitry@zend.com (Dmitry Stogov) --001a11450f402d02b5052057c389 Content-Type: text/plain; charset=UTF-8 On Tue, Sep 22, 2015 at 4:54 PM, Joe Watkins wrote: > I'd really like to understand what you're trying to say there Dmitry, but > I don't get it. > > What is your example function trying to show ? > > As it mentions in the RFC, vars in short closure are by-value, so I can't > see what side effects you might be thinking of ? > It's clear to me that foo() will return NULL, but how many warnings about unused variable $y will we get? Thanks. Dmitry. > > Cheers > Joe > > On Tue, Sep 22, 2015 at 9:25 AM, Dmitry Stogov wrote: > >> I'm against the magic - "automatically use () all of the (compiled) >> variables". >> I'm also against compound short closures with curly brackets. >> in my opinion they opens too many ambiguous questions. >> >> function foo() { >> (($x) ~> {$y = 3; return $y + $x;})(5); >> return $y; >> } >> >> also think about nested closures and use of variables from not direct >> enclosure. >> >> I'm not sure if we need all "functional programming" features in PHP, but >> if we introduce them, lets do it consistently with the existing language. >> I think, this proposal can't be approved without support for type hinting. >> >> Thanks. Dmitry. >> >> On Tue, Sep 22, 2015 at 4:59 AM, Bob Weinand wrote: >> >> > Hey, >> > >> > Thanks for all your feedback in the discussion thread! >> > >> > So, before I start the vote, just two quick notes: >> > I've added two notes about the statement syntax and the single variable >> > use. >> > Though a few people complained, I'm not switching to the ==> operator, >> as >> > I noticed many people expected typehints to work (they don't due to >> parser >> > limitations) when they compared to Hack's short Closures. It also >> allows us >> > to differ syntax-wise [e.g. for typehints] from Hack without causing any >> > confusion later. Which should be the smartest choice: Avoid conflicts. >> (If >> > anyone strongly feels against that, he may vote no, but I would like to >> not >> > bikeshed that in this Vote thread, but leave it free for eventual actual >> > issues.) >> > >> > Now, the link to the RFC about Short Closures: >> > https://wiki.php.net/rfc/short_closures >> > or straight ahead to the vote: >> > https://wiki.php.net/rfc/short_closures#vote >> > >> > Thanks, >> > Bob >> > -- >> > PHP Internals - PHP Runtime Development Mailing List >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> > > --001a11450f402d02b5052057c389--