Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104697 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 87762 invoked from network); 13 Mar 2019 23:47:39 -0000 Received: from unknown (HELO mail-lj1-f182.google.com) (209.85.208.182) by pb1.pair.com with SMTP; 13 Mar 2019 23:47:39 -0000 Received: by mail-lj1-f182.google.com with SMTP id v3so2820189ljk.9 for ; Wed, 13 Mar 2019 13:37:52 -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=WQHJR5qQDHHLJwlL/AiNr75/x+PFYYQvrCaIelxfGBw=; b=aH8GzbVgdK64IFouBqCZKx1praDnAl8m2/PhbdoU+P+y3mLYbJIB7hZFlZrlPytWo1 RAdai9ODu7f1nxDKbWzuVbZpN91y9BrQ6vresfw577kNf0sRiK6nNV8+1DaXkY5l98tE iAoBz7XlUT6FL2oUwSXXoXwKllDv9/CU1MI3HgfGSr4uwzayQfULIZcY61N380W68ZGZ TenZMTm4/PFooPwvP4HnV9c5Gq9bx8Hl+3ER1G173C6UV05UDCnOHMQNYiNqdC4HMvpH N2OIYr8qKwcE/yf064PBQlLsgPsOx0wMnZehuFeMvAkuXsy8aWI+fJBseY69/dB8IJRY BBqw== 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=WQHJR5qQDHHLJwlL/AiNr75/x+PFYYQvrCaIelxfGBw=; b=JNa5hr3opY1pL/SsdyVwsKVYfRc5e1WWEu1UK5x9HK4pvc1+AxiCk0JQyGT6pfBB5C rrV8wRgluD/2a4voBkKCT4ri4SbEaN33lQ4HRuW+56cHylM0XzEHO/VfihPpn0LMtnDW en3NLqjNTAZgYxm22VhmqVBWO6OA60UF3t1KiNEsd9+yr/k0ZX5eI7lfhi8Jf0JSzSQZ kbDYg38FNZLfzEO5aG+bFZYd5GYpt7jkPUPGnaulaT0hllyyaifirUY9cl+PZRimpWVB xb25dYrU2yTqDIj/HnZojj9Xe8qb2GdrFpS6NwSFCc8U13mTnS3DiqqnHANXtP4LgiXv QSIA== X-Gm-Message-State: APjAAAXTZ7Eocj90htVYx5Ph4sDEt+m6eQxdtm/GOT7C6WBixCJDZLT3 Z38KbSRN+fKY9ttyyHVhtDvYowEr/rur6oH5UUA= X-Google-Smtp-Source: APXvYqwaIcrwCGST32d+8SGm4Iv3hKJmHpYdiuoZSrr/BG7Uyg7xC/JJo4J0AC8SeIXVIL+SQ3ZcmRYO9ZKCbtAepUE= X-Received: by 2002:a2e:9d0c:: with SMTP id t12mr24566254lji.163.1552509471819; Wed, 13 Mar 2019 13:37:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 13 Mar 2019 16:37:40 -0400 Message-ID: To: Travis van der Font Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="00000000000094112e0583ffc771" Subject: Re: [PHP-DEV] [RFC] Arrow functions / short closures From: chasepeeler@gmail.com (Chase Peeler) --00000000000094112e0583ffc771 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 13, 2019 at 4:26 PM Travis van der Font wrote: > Arrow functions are ternary operators to functions. > While they are nice and shorten, they can be hard to read at times; > considerably to people who aren't used to them which is surprisedly a > majority of PHP programmers. > > Having them optional sure, but not necessary. > > Feel free to decide between fn() or f() as both are equivalently > comprehensible to the same level of minimalism. > Anyone considered? ($x) =3D> $x * $multiplier > > I use this format a lot in javascript, so I like not having any indicator= . I can't remember which language it was, but they didn't even require the parentheses if there was only a single input: $x =3D> $x * $multiplier; > #mytwocents > > Kind regards / L=C3=A9if Gr=C3=A9iss, > Travis van Font > > > Le mer. 13 mars 2019 =C3=A0 16:57, Nikita Popov a = =C3=A9crit > : > > > 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) =3D> $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 > > > --=20 -- Chase chasepeeler@gmail.com --00000000000094112e0583ffc771--