Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96171 invoked from network); 19 Feb 2013 17:03:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2013 17:03:58 -0000 Authentication-Results: pb1.pair.com header.from=g.b.yahav@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=g.b.yahav@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.54 as permitted sender) X-PHP-List-Original-Sender: g.b.yahav@gmail.com X-Host-Fingerprint: 209.85.219.54 mail-oa0-f54.google.com Received: from [209.85.219.54] ([209.85.219.54:36728] helo=mail-oa0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/0F-17768-C70B3215 for ; Tue, 19 Feb 2013 12:03:57 -0500 Received: by mail-oa0-f54.google.com with SMTP id n12so7187413oag.13 for ; Tue, 19 Feb 2013 09:03:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=gpDqqhj4nM437zjI9SLEsTYEw9p08K9YC5A8JBfDu+4=; b=ckPF/Xeh0wqz19ScSckcWlQOtX2HAuQUTbYRyL3noJ8Y5HpZeLs+/NleqeeqPghLI/ fgKLORlQCVV3VylfGJ7CcDdfoC76PFDrrqQbhSpzOcoOsVxTwfV9kFDq8psAUVAo2zwn qUpAyG5wIm+Tz3PD428GdwKhJJdBwyRw76JB3QUSM/2v1+F+L22uHQrROhToTqNMlbdB l1YXgHk4GJmlyAkKrjNYM8McTxWYAUe7a4XDmaEw3xtxhM5W3ISKVkritrBr0dNLr+bJ bq+AlDnC7OYcRKM4M0entOYLL733+Da/K6aep3PG6iepwSOg7EKHIn5sipGNlN5Ql8S3 xK1A== X-Received: by 10.182.157.104 with SMTP id wl8mr2594137obb.79.1361293434232; Tue, 19 Feb 2013 09:03:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.151.4 with HTTP; Tue, 19 Feb 2013 09:03:34 -0800 (PST) In-Reply-To: References: <8490FC41-2696-4948-83A1-3931674183B0@gmail.com> Date: Tue, 19 Feb 2013 19:03:34 +0200 Message-ID: To: Levi Morrison Cc: Florin Razvan Patan , Marcello Duarte , PHP Internals Content-Type: multipart/alternative; boundary=f46d044281a0951ede04d616d3a8 Subject: Re: [PHP-DEV] [RFC] Short syntax for anonymous functions From: g.b.yahav@gmail.com (Yahav Gindi Bar) --f46d044281a0951ede04d616d3a8 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 19, 2013 at 6:40 PM, Levi Morrison wrote: > > Say we agree on the syntax above > >> ($n) |$m| => $m * $n; > > What happens when my one liner function needs to do one more operation > > like checking the value of $n before multiplication? > > As I stated before suggesting the syntax: It's only meant for a single > expression. It's purposefully NOT intended to cover multiple > expressions. In that case the current (verbose) syntax is better for > all criteria I care about. Additionally, neither Python nor Dart > allows multiple expressions in their short-syntax functions. > > +1 A similar syntax was applied in C# lambads. For example : m => m * n. Though C# allows to use code block in lambdas, I do think that we should focus on one-expression only, since the current callbacks syntax (function() { }) is great, I believe, for multiline code. > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --f46d044281a0951ede04d616d3a8--