Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87979 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32512 invoked from network); 1 Sep 2015 08:32:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2015 08:32:44 -0000 Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.178 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.213.178 mail-ig0-f178.google.com Received: from [209.85.213.178] ([209.85.213.178:35376] helo=mail-ig0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/B0-27722-AA265E55 for ; Tue, 01 Sep 2015 04:32:43 -0400 Received: by igbut12 with SMTP id ut12so44649854igb.0 for ; Tue, 01 Sep 2015 01:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HPT3NKnomHRu52RnvDuEwofcpplVy2tUE2FLF2UCQLA=; b=yySXLjAb5rBehSaxTSiLk6RL/GL0NuRhWEV71GRe2aHLr0yQcaVecl5OPJcqhAQpTd DBbKot2xz4N1zZRPz5eYLGdveFLcmXaXb7NAf9JH3hPfWk5WNtrWlW35hVHK/kFiBVYG yXMf8SIqzDL2EHMBgqJfhlJ8fFHdJ9k6LD7wtnjg+xl9NlPGJX9WFVBhHssKADtIUUFN TGyOYt7ZomSQxmuYl/hVLu8jKN/UP7TaGcx1xU9Pyp0fuuW1FzLJO6j3WDjhIQLa3I0Y dT8ReHNpy/1OrFcylTU6IcBJMtsU+c2K1KNrioUVv4zyLMF/cSG/g22XgZg2mZuijrwK PqEg== MIME-Version: 1.0 X-Received: by 10.50.59.148 with SMTP id z20mr1393936igq.77.1441096360054; Tue, 01 Sep 2015 01:32:40 -0700 (PDT) Received: by 10.107.24.194 with HTTP; Tue, 1 Sep 2015 01:32:39 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Sep 2015 10:32:39 +0200 Message-ID: To: Bob Weinand Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] [Discussion] Short Closures From: pajousek@gmail.com (=?UTF-8?Q?Pavel_Kou=C5=99il?=) On Mon, Aug 31, 2015 at 9:29 PM, Bob Weinand wrote: > I had this RFC in draft since some time, but delayed it due to all the ongoing PHP 7 discussions. Also we have no master branch to merge features in until 5.4 EOL. Thus I'm reviving this now. > > Time for the first RFC targeting PHP 7.1 (assuming PHP 8 isn't going to be the next version ;-)): > > The short Closures RFC: > https://wiki.php.net/rfc/short_closures > > Hoping for constructive feedback, > Bob > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hi, as a purely userland developer, I would definitely appreciate the shorthand function for anonymous functions; having tons of stuff like "function ($x) { return $x * 2; }" makes the code less readable in the end. I'm not sure about the "auto using" of all variables though; wouldnt it be possible to statically check for the used variables and only import what's needed, for performance reasons? Also, how hard would it be to add type hints (only for parameters)? Sometimes they are needed to make the IDE know the variable type because it can't be guessed automatically. I know about your note in RFC,this is just a question to other internal members.Return type can be infered by IDEs from the simple expresion quite easily. PS: would "() ~> foo()" work? I think it should, but I couldn't find a mention about it in RFC. :) Regards Pavel Kouril