Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34163 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64068 invoked by uid 1010); 20 Dec 2007 19:07:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64040 invoked from network); 20 Dec 2007 19:07:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2007 19:07:49 -0000 Authentication-Results: pb1.pair.com header.from=troelskn@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=troelskn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.184 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: troelskn@gmail.com X-Host-Fingerprint: 209.85.198.184 rv-out-0910.google.com Received: from [209.85.198.184] ([209.85.198.184:1924] helo=rv-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/90-59226-57DBA674 for ; Thu, 20 Dec 2007 14:07:46 -0500 Received: by rv-out-0910.google.com with SMTP id c24so2666621rvf.15 for ; Thu, 20 Dec 2007 11:07:23 -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:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Jt3sOu1hCYdrBV9vD8n6W/MFpPYLkhLr291qbT1L8xA=; b=MqdJ0ZB9oHgy3HUFuk6v1gHZqVXG5ZiylV09BefS+YMF7VcH4yZNIYHxQDmLjdVvQQC1JyC7OCPBJawNOojk7l923eRjxyrZWBNdScWJB285XHo/uyGfWXbE14kZGuhZIZ3GRiY2KhclcnOtMdNCGfK5ieZHYaqzZlHGJT41l88= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QIcLuASnaCnNaok/jm5joi0rr/v78fcaE0yOOY61RGI8u9I53ccuVcuui8yNhNCS77ZB9DDTLN8FoiNQX8MX5edL6FOR6VSJOQ9IBbtKeFx5SkQqpfQ4h1e2AW9Eg8jsaJQPT0tmkKg5HYXHEDRdFxz3LdWKdI68gvuDsjP99DQ= Received: by 10.141.163.12 with SMTP id q12mr208854rvo.190.1198177643322; Thu, 20 Dec 2007 11:07:23 -0800 (PST) Received: by 10.141.50.16 with HTTP; Thu, 20 Dec 2007 11:07:23 -0800 (PST) Message-ID: <98b8086f0712201107w7b497a98gf0ca2d5aab64ca2c@mail.gmail.com> Date: Thu, 20 Dec 2007 20:07:23 +0100 To: internals@lists.php.net In-Reply-To: <12F80350-F0D2-45D2-9762-B6F361D3704E@caedmon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <4FADC266-873E-4FD2-BEC8-28EA9D833297@procata.com> <200712172341.54372.larry@garfieldtech.com> <98b8086f0712191345h7fe11a7kc5d34b0369754c8f@mail.gmail.com> <47699960.1090101@zend.com> <98b8086f0712191528n2fd348d0oe3da9eed20d87194@mail.gmail.com> <4769ACF5.7000701@zend.com> <476AA387.3070002@zend.com> <12F80350-F0D2-45D2-9762-B6F361D3704E@caedmon.net> Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: troelskn@gmail.com ("troels knak-nielsen") On Dec 20, 2007 7:02 PM, Sean Coates wrote: > Apart from saving a few keystrokes, the above could easily be changed > to the following, which is much more clear, DOES compile at compile- > time, and works without adding a new construct that looks like a > closure, but is not indeed one: > > function aiusdyasdjkhasdIMASHEDTHEKEYBOARD($test){ return 3 === ($test > % 4) } > array_filter($my_data, 'aiusdyasdjkhasdIMASHEDTHEKEYBOARD'); > I'm not sure. Are you using this as an argument _for_ or _against_? Because to me, that looks ridiculous. It won't work either. You have to add guards, to prevent a fatal error, if you include the file twice. So the entire "solution" would be: if (!function_exists('aiusdyasdjkhasdIMASHEDTHEKEYBOARD')) { function aiusdyasdjkhasdIMASHEDTHEKEYBOARD($test){ return 3 === ($test % 4); } } array_filter($my_data, 'aiusdyasdjkhasdIMASHEDTHEKEYBOARD'); > At risk of wading into yet circular another discussion on internals@, > I was part of the original thread on this subject, and I agree with > Stas here: unless they're real closure, they're pretty useless. I don't believe that has been Stanislavs point so far. As I understand it, he says that adding the syntax, without adding closures, may confuse people, who then will intuitively expect closures. That is not the same as saying, it is useless. On the point of uselessness, I have already explained how it would be a useful construct. On Dec 20, 2007 7:09 PM, Stanislav Malyshev wrote: > > and you did it again :-) Not working? What the hell are you talking of? > > We can easily make it working with whatever feature set we want. We do not > > We meaning who? I can't "easily" make closures working in PHP. And even > if I could, I'm not sure I want to. I agree fully. Static scope should not be implemented in PHP. Could we discus the patch, rather than something, which is purely theoretical and only marginally related? -- troels