Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69675 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33270 invoked from network); 18 Oct 2013 12:39:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2013 12:39:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-ie0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:40254] helo=mail-ie0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/C1-23638-31C21625 for ; Fri, 18 Oct 2013 08:39:47 -0400 Received: by mail-ie0-f177.google.com with SMTP id e14so6106153iej.8 for ; Fri, 18 Oct 2013 05:39:44 -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=EdlVrDlHAG6ys1q3XK0aWfKrA9FWHjnQx/sLWJof+wM=; b=ktgSfPJZk+1KIb/Ao8H5jjy5k2/jPJvnZ3tfvRlkzOp1w+cBJb1YDsCl+irtjosrlJ 1m11G4QQu9bop145NERf/Zc6SgqvVwiI+2cfwwNFtfTewklibjWQDLQAtawXlVpjBwp/ p3iTARW39XVwUmzIDnO8n1c5zpqkwCQpYOBDW7950O89wRLms/RNe7nKvNR+ja9S2uZ7 5CLOtkKFHKSWGgSSPVjf5cFeUyQpkEAg2A6wnIkKYwkw+mUdnsk0eXJ+Y1MHFL+VrnkB lu0SI/lzVUeu2FBmY8eDtD214ulRBSl3GpeP3MHWGmseTZPhQ0ACOYYVuN9q9v7c3E2p PM4Q== MIME-Version: 1.0 X-Received: by 10.42.190.142 with SMTP id di14mr1627823icb.45.1382099984733; Fri, 18 Oct 2013 05:39:44 -0700 (PDT) Received: by 10.50.73.42 with HTTP; Fri, 18 Oct 2013 05:39:44 -0700 (PDT) In-Reply-To: References: <525C631E.1050008@gmail.com> <52610FFE.7020806@googlemail.com> Date: Fri, 18 Oct 2013 14:39:44 +0200 Message-ID: To: Nikita Popov Cc: Crypto Compress , PHP internals Content-Type: multipart/alternative; boundary=20cf303ea4b8a25e8404e9033aab Subject: Re: [PHP-DEV] Proposal to deprecate create_function() From: tyra3l@gmail.com (Ferenc Kovacs) --20cf303ea4b8a25e8404e9033aab Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Oct 18, 2013 at 2:19 PM, Nikita Popov wrote: > On Fri, Oct 18, 2013 at 12:39 PM, Crypto Compress < > cryptocompress@googlemail.com> wrote: > > > Hello, > > > > shure all things can be replaced with more and verbose code. What is th= e > > benefit of writing all this lines in contrast to one method call? > > https://github.com/phpcr/**phpcr-utils/blob/master/src/** > > PHPCR/Util/Console/Helper/**PhpcrCliHelper.php#L111< > https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/Console/H= elper/PhpcrCliHelper.php#L111 > > > > > > -1 for removing wrappers/abbreviations/and such > > +1 for bugfixing > > > > Best, > > CC > > > > Could you maybe elaborate a bit on your use case there? I.e. provide some > context as to why the create_function call there is necessary and why it > can't be replaced with use of anonymous functions (and maybe also what > additional constraints there are). For people like myself that are not > familiar with the exact workings of that library. > > Thanks, > Nikita > I guess he is trying to say that writing a factory method for producing callable/anonymous functions are easier with create_function than with closures, because you call eval implicitly, instead of explicitly. I've only skimmed through the thread, but did somebody already proposed changing the return value of create_function to return a closure instead of deprecating it? That way we could keep bc and remove the ugly null-prefixed hidden function from the global function table. If we really we want 100% compatibility, we could even add a __toString to the Closure object with an internal function name (similar was proposed by Joe for anonymous functions and I listed it as a con, because not matching the current behaviors of Closures) through which it can be called as a string while throwing a STRICT/DEPRECATED error so people can move away from manipulating the return value as a string, and we can remove that behavior later on. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --20cf303ea4b8a25e8404e9033aab--