Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47039 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74813 invoked from network); 23 Feb 2010 22:58:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2010 22:58:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.223 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 209.85.220.223 mail-fx0-f223.google.com Received: from [209.85.220.223] ([209.85.220.223:61612] helo=mail-fx0-f223.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/F0-03187-69D548B4 for ; Tue, 23 Feb 2010 17:58:31 -0500 Received: by fxm23 with SMTP id 23so372741fxm.23 for ; Tue, 23 Feb 2010 14:58:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=rFFYa4NGZ2Pga346idWjnVnSQqhwOJ98wQatjAYkqW4=; b=VYzfZdHcvD5jlH4b9nV7O/boBE1oga6ebxyyWrIRpHVaTZWQHqjXxwjbFRB+tG2H7c L4r1haEtLbaGGlJbk+WxH8kUbK0kyCLogooi/pNNSfk7BisG/QpdPSepXBCOHq0Un36J mWsdo5dJVwa8AgpzGCRZ6YBaqGh2v2Qk6bCvM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=W/7U6X/5LqglLaaaWGarBsKruRw/fXbkHUHwxzWko2xKfwcECZ9jsQcmQQYo/HdtFK vuMXUMzvfGRNKj1F/7HoqWvFq0+MZg2TgQYncYOg9BKsByHHD05ZZZYHHmOchUiNfA44 F7bVKiqtxs1YS5qymKrXdti3rbL2QbjRD5dH8= Received: by 10.87.62.1 with SMTP id p1mr8486809fgk.42.1266965907062; Tue, 23 Feb 2010 14:58:27 -0800 (PST) Received: from 89-36-11-205.stedu.ro ([89.36.11.205]) by mx.google.com with ESMTPS id e11sm978720fga.16.2010.02.23.14.58.25 (version=SSLv3 cipher=RC4-MD5); Tue, 23 Feb 2010 14:58:26 -0800 (PST) Message-ID: <4B845E0C.7040005@gmail.com> Date: Wed, 24 Feb 2010 01:00:28 +0200 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <4B54FC87.8070106@zend.com> <4F.56.22457.408955B4@pb1.pair.com> <4B55D850.8000604@zend.com> <4B808294.1070801@keryx.se> <4B844DBA.4050804@zend.com> In-Reply-To: <4B844DBA.4050804@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] On closures and lamdba From: ionut.g.stan@gmail.com ("Ionut G. Stan") > This is not entirely correct, you are right. There's a difference > between anonymous function and closure, though in practice in PHP > anonymous functions are closures (though some of them are rather trivial > ones with no variables to "close over") and that's now the only way to > do closure in PHP (i.e. you can't have non-anonymous closure function). Correct me if I'm wrong, but given the fact that PHP only* supports functions defined in the global space**, with the additional ability to import global variables using the global statement, wouldn't that make named functions able to close-over global variables? And, if the above is true, wouldn't it be consistent to support the use statement on named functions, and then deprecate the global statement? I remember one of the first implementation for closure, used a statement similar to global for closing over variables (the lexical statement). Thanks, * I know it allows definition of function inside other functions, which will ultimately end up in the global scope. ** namespaced functions don't make any difference, as variables aren't namespaced. -- Ionut G. Stan I'm under construction | http://blog.igstan.ro/