Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87984 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40932 invoked from network); 1 Sep 2015 09:00:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2015 09:00:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=pajousek@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pajousek@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.179 as permitted sender) X-PHP-List-Original-Sender: pajousek@gmail.com X-Host-Fingerprint: 209.85.213.179 mail-ig0-f179.google.com Received: from [209.85.213.179] ([209.85.213.179:34134] helo=mail-ig0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/82-27722-B1965E55 for ; Tue, 01 Sep 2015 05:00:11 -0400 Received: by igui7 with SMTP id i7so73857724igu.1 for ; Tue, 01 Sep 2015 02:00:08 -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=M8KJxNqr/feO0ODFOVduTxwksfsdEZF5ZjDbqIS2Ju4=; b=oa4VBOQymFTX16Fv7KDdijq7akqNzt4GTTnfy0DxsuhnKIgznb21qzMCNYu1YfL2Jl u8tupGCoYbFB+f37uJwaeMc6JcA5SuF/D0O24hDLwNQ03miiCnsv+H25QGP3S7Jmvc0x RLkmmo7ul2gdB0cfiMqvCsSp+DpjwyeHqKF9p/Np/ES41+sSIfp1w+7Nxb4yBFWpUcxK SV5Ps5eyZ+wrWsOkGnsLT19loh50Rn/WOV9/KHmamMrA/bACQndZYo+xadoktD33g71u mUfNyRlRBfg6lhChBVgbkUzY/HpDd+iRmEVNq0K5n38rKxKKSUcHTC7m3Ydq2N/CLxIt JmaQ== MIME-Version: 1.0 X-Received: by 10.50.2.39 with SMTP id 7mr1235414igr.86.1441098008805; Tue, 01 Sep 2015 02:00:08 -0700 (PDT) Received: by 10.107.24.194 with HTTP; Tue, 1 Sep 2015 02:00:08 -0700 (PDT) In-Reply-To: References: Date: Tue, 1 Sep 2015 11:00:08 +0200 Message-ID: To: Anthony Ferrara Cc: Bob Weinand , 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 Tue, Sep 1, 2015 at 10:44 AM, Anthony Ferrara wrote: >> 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? > > That's precisely what's happening. Not all variables are bound, only > those that are used. Somehow somewhere in this thread the confusion > was implied that the entire scope is copied. > Oh, nice - thanks for explaining that. :) >> 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. :) > > Typing on closures is outside the scope of this RFC. > > With that said, I'd love to hear and see examples of this. It's > something I definitely want to do, just haven't come up with a good > enough way to do it... > Yeah, I know it's outside of the scope of the RFC, it was more of a general question whether or not it would be possible in the future. Also, exactly what examples would you want to see? Pavel