Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64102 invoked from network); 4 Aug 2011 11:39:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2011 11:39:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:46832] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/18-18399-CF48A3E4 for ; Thu, 04 Aug 2011 07:39:41 -0400 Received: from [192.168.2.230] (ppp-93-104-47-108.dynamic.mnet-online.de [93.104.47.108]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 11D9D774C7; Thu, 4 Aug 2011 13:39:37 +0200 (CEST) To: Ryan McCue Cc: Lazare Inepologlou , Rasmus Lerdorf , internals@lists.php.net In-Reply-To: <4E3A8014.1030503@rotorised.com> References: <4E3A48F2.4000503@lerdorf.com> <4E3A8014.1030503@rotorised.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 04 Aug 2011 13:39:35 +0200 Message-ID: <1312457975.1541.7.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.2 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] An implementation of a short syntax for closures From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Thu, 2011-08-04 at 21:18 +1000, Ryan McCue wrote: > Lazare Inepologlou wrote: > > Thank you for your interest. This is just a proposal that I have tested and > > works. Of course, the final syntax can be different. Syntax is always a > > matter of taste :-) > > As much as I love the idea, I have to agree that using | doesn't really > make sense here and actually makes the readability worse, IMO. However, > I can't really think of a better operator. ( $x ) => $x + 1 for example > would be ambiguous if used in an array definition, but is otherwise the > best in terms of readability. If you go there you can also allow more complex statements and re-use symbols used to group statements, using a syntax like ( $x ) { $x + 1; } Oh wait - now we've reached a point which was mentioned in this thread already "allow to drop the function keyword". Back when I proposed to drop "function" a key argument was that people wanted an easy way to grep for function declarations. I accepted the validity of that concern and think this might be a case here, too. The difference of these few characters is not that much but the keyword gives a clear guidance what's going on, else you might end up with a long list of random characters next to each other ... johannes