Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88405 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43915 invoked from network); 22 Sep 2015 13:54:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2015 13:54:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.160.173 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.160.173 mail-yk0-f173.google.com Received: from [209.85.160.173] ([209.85.160.173:36115] helo=mail-yk0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/8B-56639-4AD51065 for ; Tue, 22 Sep 2015 09:54:45 -0400 Received: by ykdt18 with SMTP id t18so9422967ykd.3 for ; Tue, 22 Sep 2015 06:54:42 -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=0qsxpPNAR/Syt/ye5Sc7RhTrnheQ/17O/cKOdvm2vHU=; b=QuWVVSgzbzikfZKnqRcUBXSLhFlCisGAiNUWrZJiw0qXzaQGdVtFEsiHsBnxEjsNBo dI36cLLLA0/uZTUPPvZ9DMtpy/0CR1mmVCsC2W+8C/QEXsGOV67MQsrWqMCNoaIXe8XV jz30acFtLOzIc2U2j+1DpuF9pSx2whibTTMibz7lAeRxDsGZ9ncC9FSYE8F6JDaP42Sx dCzofp7MmOnwXPe9qqUhZonjvF8Yth8/VeLRWtfXXXASS/ggADVQKrDEiIUvTlru03dv CinnJ8DsTq8w+B8Yu7+6LQ5m0Z5NCE97L5BspLUghMWiAuKm6uHDPZ51vTEoJJhN/S23 bifA== X-Gm-Message-State: ALoCoQntpTQML0Ty8C+zqhoQ/Cc0UMBrK9+3yhesaPPyRfLvHXFUg+Lh8T/i8gh9aNk8TyF1rKp9 MIME-Version: 1.0 X-Received: by 10.129.23.211 with SMTP id 202mr20646779ywx.102.1442930081899; Tue, 22 Sep 2015 06:54:41 -0700 (PDT) Received: by 10.129.111.197 with HTTP; Tue, 22 Sep 2015 06:54:41 -0700 (PDT) X-Originating-IP: [217.39.65.241] In-Reply-To: References: Date: Tue, 22 Sep 2015 14:54:41 +0100 Message-ID: To: Dmitry Stogov Cc: Bob Weinand , PHP internals Content-Type: multipart/alternative; boundary=001a1142d2aaf7dbcb052056569e Subject: Re: [PHP-DEV] [RFC] [VOTE] Short Closures From: pthreads@pthreads.org (Joe Watkins) --001a1142d2aaf7dbcb052056569e Content-Type: text/plain; charset=UTF-8 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 ? 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 > > > > > --001a1142d2aaf7dbcb052056569e--