Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104731 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27948 invoked from network); 15 Mar 2019 12:10:55 -0000 Received: from unknown (HELO mail-ed1-f53.google.com) (209.85.208.53) by pb1.pair.com with SMTP; 15 Mar 2019 12:10:55 -0000 Received: by mail-ed1-f53.google.com with SMTP id r23so6932462edm.7 for ; Fri, 15 Mar 2019 02:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ibi1tDkZQtMtqzXX+PTauvNrg6UpgQCFmaZt3NP+I/g=; b=rVivkp81p33vcY1ok5OFsL/W3eh1Gd0NHh6Yhh5S5l8/pWWsFTRRLMvDq/iJMSahR2 IrZwVT49HFzxmhdnz6GFS5YU9x6FyIIkoxnFej2LhRgN3KNNDAjNyw18UaNiIaltqfP3 044sKbmOXdeBd0Dm6QwLVo5KX+ljyPX5G/PIcxhVWmjQFJ8k0HruVzT1Y7aP4fVPKJTy A5PSZHRWVWv2vnPkgsENyPm08uDVlB5d9UyCugT5GkDIdMbxk0mGmNJAG51zfiJoCUkZ pX31UIRGWGY1+lDGq3NgTfVhPA5lmz4v4QFY6hZviTYh1/HiN6P936wPA2KGON/i+nZV OX0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ibi1tDkZQtMtqzXX+PTauvNrg6UpgQCFmaZt3NP+I/g=; b=kG8vDgiJkfs3DfpIxDx3Gm33Ju8Z+3p8ZgaH4cGmy39kUc6U/akKUloUdLdUcG/TzO HBTU8rq5JiG00ih3RJl9yePmnn/Z0VC5IvgGs8lhMf2VLBRTTkXrGyWSLF6BPbnIMNoe yXOAuQYOiqYewA09Eb71+DsvtSaB+OXRLVuhLtOMeHAmAW/G3DjB3b5JYJvIwMeAbgCl xXgcg7B+ivTymevZ5i8aG4p78vfaf03Ch/fR/+kPXExFrHHmVoaZHXsb06QWS/9D3RqG EnOdi5Q64u0T4L6jYBPpaMGW22y3f+BgG5VimZSc8/mz2Y+a8g3ksFDrAtvYXSkdNeGR uq6Q== X-Gm-Message-State: APjAAAUhNnXiHeM/WNXUBt5I9wV8ZQiUOI1xt2ZhJxicUdOe7ncXUdYt aTIlxyU0+P3O8WgqaBEAXxfPvEG2UelbcLkNMmA= X-Google-Smtp-Source: APXvYqy/P1O6V+SoF9hxu1mvAX8JUenUuGoQr+L5hxo+zeqDnCRnAMYr/qx97alYtV08hCGyM7W378NdKck3GAtk7Kk= X-Received: by 2002:a17:906:33d5:: with SMTP id w21mr1572656eja.152.1552640490654; Fri, 15 Mar 2019 02:01:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 15 Mar 2019 11:01:03 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000e8cf7c05841e4854" Subject: Re: [PHP-DEV] [RFC] Arrow functions / short closures From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000e8cf7c05841e4854 Content-Type: text/plain; charset="UTF-8" Hi, To start with, I personally understand why a prefix character is needed before parenthesis to make the parser simpler. I would like another simpler option but will have to investigate more on this. My question would be: whatever syntax we are going to use that has arrow syntax, let's say *$f = \($x) => $x * 2;* are we going to also support the arrow block version?: *$f = \($x) => {* * // more operations that will have better visible on multi-line* * return $x * 2;* *}* This is present in other languages and was thinking that we could have it in PHP also. Regards, Alex On Wed, Mar 13, 2019 at 5:57 PM Nikita Popov wrote: > Hi internals, > > Motivated by the recent list comprehensions RFC, I think it's time we took > another look at short closures: > > https://wiki.php.net/rfc/arrow_functions_v2 > > This is based on a previous (withdrawn) proposal by Levi & Bob. It uses the > syntax > > fn($x) => $x * $multiplier > > and implicit by-value variable binding. This example is roughly equivalent > to: > > function($x) use($multiplier) { return $x * $multiplier; } > > The RFC contains a detailed discussion of syntax choices and binding modes. > > Regards, > Nikita > --000000000000e8cf7c05841e4854--