Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35155 invoked from network); 21 Feb 2013 15:32:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2013 15:32:07 -0000 Authentication-Results: pb1.pair.com header.from=linepogl@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=linepogl@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.45 as permitted sender) X-PHP-List-Original-Sender: linepogl@gmail.com X-Host-Fingerprint: 209.85.219.45 mail-oa0-f45.google.com Received: from [209.85.219.45] ([209.85.219.45:51225] helo=mail-oa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/85-05272-5FD36215 for ; Thu, 21 Feb 2013 10:32:06 -0500 Received: by mail-oa0-f45.google.com with SMTP id o6so9171384oag.4 for ; Thu, 21 Feb 2013 07:32:02 -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=BHrSAjjkRlkxCYE0RIwK6Vw9qhUXXHB/K5tq519V7AQ=; b=CrK0N3SyMFHo3ZG/Nj83cb6K2asU5t1ENc97roz03nTJYtU6FCd896ddKkrIYneE7j 4Ref3n09+AehFJ6LaACmOVJ6v4Wnop2SlDa/EQBKXj4yjXEO5/9bqeuAdK8yPYLHwUSQ bUL6BvIxC97oQ3jSMGI1p65fKLgwgSPtkr/nfG6j+v7AcSN8Jy47W96D8kk2lLc1XDIT vWJo582DQVeJ6yGO9SJWpETm/yHpc6EmYYR90mWPcIFK5RIZJO2XgkB6qoLjxbyE9FKH dcr0A4jO3AO/gXtw/ekXAW/1QyR3fZnXNdYoAmL0RvZvZ6Jd11v0VXLHCUyCyCMuncaF we0Q== X-Received: by 10.60.24.197 with SMTP id w5mr1961972oef.6.1361460722624; Thu, 21 Feb 2013 07:32:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.167.202 with HTTP; Thu, 21 Feb 2013 07:31:42 -0800 (PST) In-Reply-To: References: <8490FC41-2696-4948-83A1-3931674183B0@gmail.com> <288800174.20130220052301@cypressintegrated.com> <14B2EAAC-0B40-44C2-84E8-99B89C7398D0@gmail.com> Date: Thu, 21 Feb 2013 16:31:42 +0100 Message-ID: To: Levi Morrison Cc: David Muir , Sanford Whiteman , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8ff1c30ebf67e604d63dc6fe Subject: Re: [PHP-DEV] [RFC] Short syntax for anonymous functions From: linepogl@gmail.com (Lazare Inepologlou) --e89a8ff1c30ebf67e604d63dc6fe Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2013/2/21 Levi Morrison > On Thu, Feb 21, 2013 at 4:17 AM, David Muir wrote: > > > > On 21/02/2013, at 6:12 AM, Lazare Inepologlou > wrote: > > > >> 2013/2/20 Sanford Whiteman < > swhitemanlistens-software@cypressintegrated.com> > >> > >>>> It still looks like some random characters bashed together by a monk= ey > >>>> with a keyboard. > >>> > >>> +1, I am a fiend for ternary expressions and crazy one-liners, but > >>> this makes me want to go back and unroll everything I've ever done > >>> into readable code. :) > >>> > >> > >> Long code is not always equivalent to readable code. A shorter syntax > could > >> improve readability in *some* cases. > >> > >> Long: > >> $users->OrderBy( function( $x ){ return $x->Surname; } ); > >> > >> Short: > >> $users->OrderBy( $x =3D=3D> $x->Surname ); > >> > > > > I think your example proves the opposite. The fist example was much > easier to read and understand than the second. > > > > Obviously that's up to interpretation; I think the second is better > though I don't understand why `=3D=3D>` is there instead of something > simpler. > It's just an example, and it's not important. I wanted to use something that is similar to the key-value mapping operator, but not the same. What is important is that the short version is declarative: emphasis is put to what to do, not how to do it. The mechanics are not exposed, and this is why some may find it harder to understand at first sight. Lazare INEPOLOGLOU Ing=C3=A9nieur Logiciel --e89a8ff1c30ebf67e604d63dc6fe--