Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70389 invoked from network); 4 Aug 2011 12:19:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2011 12:19:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:52213] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/19-18399-76E8A3E4 for ; Thu, 04 Aug 2011 08:19:51 -0400 Received: by vwl1 with SMTP id 1so1139839vwl.29 for ; Thu, 04 Aug 2011 05:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=yMps9Dh5voQpoLKDvSgRuKOQuUcf8GU9SdYxmjJkd5w=; b=R5TbCNws9h5avzbfPdvUMAR/9XIUncFMT+X5mf2S41nGvHGdKf4wz3OVB/HE0s7/1T JCZjJ1s1OjE02zBKmi3lOy0iXLfpiOL7fgaISqjcOSEYdH/dAAlB4Sa0iceSpjv/wR0k xMFShSWzpvMd7TrB1yWb717SdMP8dzzBjSdrs= MIME-Version: 1.0 Received: by 10.52.20.77 with SMTP id l13mr761788vde.351.1312460388542; Thu, 04 Aug 2011 05:19:48 -0700 (PDT) Received: by 10.52.185.41 with HTTP; Thu, 4 Aug 2011 05:19:48 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Aug 2011 15:19:48 +0300 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] An implementation of a short syntax for closures From: arvids.godjuks@gmail.com (Arvids Godjuks) 2011/8/4 Lazare Inepologlou : > Hello everyone. > > I am new to the php-internals list. I have joined because I have > implemented a feature that I would like to be included in the php > language: a shorter syntax for lambdas. I am going to briefly present > it here. Apologies for the long (and yet incomplete) e-mail. I am > ready to write a more complete RFC in the wiki, however, I would > appreciate having some directions for that. Do I have to ask for > permission first? Is it open to anyone to submit an RFC? > > The stuff... Absolutely against such a syntax. Just try to imagine that you have to actually not only write code, but you have to edit it and it can be written by someone else. The syntax we have right now is a bit wordy (is there such a word? :) ), but it makes code easily readable and formatted. Consider JavaScript - it has function keyword for lambdas and no one is complaining. Besides it lets you to indent your code beautifully: $a->select(function($x) { return $x->getName(); }); Or like this: call_some_function( $param1, $param2 function ($x, $y) { return $x * $y; } ); And so on. If you write it in one line - it will become ugly one way or other no matter the syntax. Just make a Live Template (or whatever it's called in your IDE) for somethink like "labd" => function (#vars#) { #body } for auto-complete and be happy. Is PHP still going the KISS way? PHP does not have different syntax's for same things except few exceptions witch make sense and didn't allowed such additions in the past. Please, can I ask the core team to stay on the same line in the future :)