Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69669 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21257 invoked from network); 18 Oct 2013 11:06:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2013 11:06:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.173 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.173 mail-we0-f173.google.com Received: from [74.125.82.173] ([74.125.82.173:39384] helo=mail-we0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/82-06505-44611625 for ; Fri, 18 Oct 2013 07:06:45 -0400 Received: by mail-we0-f173.google.com with SMTP id u57so3611328wes.32 for ; Fri, 18 Oct 2013 04:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=YLsTKafsHTQQxNflv3Q2X5lYLri5FI3At5JrtCjJa0c=; b=i/q2iYfZMLwOZ0sj5Je1QW1LAg5ZuF7CVG8cbvtgxFYlqIcQHX4YKnnDKmWxR8dNBX Ev5ZysuFlSem5Zq15jYqAMAIuv8FgTE/qIFhyhJ3BoQR7J46WQQ3xH3smf/QLzjZCqv9 UAn9JQCNeQHSZAapV2OY1FrBSzbW01mIFFVf6HyEh2bOKVCkzuAmAVejcOH5dwpTBk8u XVBEyzjNs6lRE8BjGrF43Y3dt8BUNVZW885lLZFvuleJKwIZWGOEZ19XwujabEtxNxmV xyxyZito1F+Rj9Q4R7HHPILW08sFJky4EcOIm6UMKFGuqOOh3FS7kygh1HRoLUi70/wJ bkDg== X-Received: by 10.194.192.131 with SMTP id hg3mr7770wjc.78.1382094401600; Fri, 18 Oct 2013 04:06:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.5.9 with HTTP; Fri, 18 Oct 2013 04:06:01 -0700 (PDT) In-Reply-To: <52611431.7070407@googlemail.com> References: <525C631E.1050008@gmail.com> <52610FFE.7020806@googlemail.com> <327CCB6F-3D5B-410E-84BB-547467E688B1@gmail.com> <52611431.7070407@googlemail.com> Date: Fri, 18 Oct 2013 13:06:01 +0200 Message-ID: To: Crypto Compress Cc: PHP internals list Content-Type: multipart/alternative; boundary=047d7b5dba7ada870f04e901ed20 Subject: Re: [PHP-DEV] Proposal to deprecate create_function() From: krebs.seb@gmail.com (Sebastian Krebs) --047d7b5dba7ada870f04e901ed20 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 2013/10/18 Crypto Compress > Am 18.10.2013 12:51, schrieb Alexey Zakhlestin: > > On 18.10.2013, at 14:39, Crypto Compress >> wrote: >> >> Am 18.10.2013 11:26, schrieb Nikita Popov: >>> >>>> You can even replicate the exact >>>> behavior (minus the hiding from get_defined_functions) with just four >>>> lines >>>> of code (though I have no idea what you could possibly need this for): >>>> >>>> function create_function($params, $code) { >>>> static $i =3D 0; >>>> $name =3D "create_function_" . $i++; >>>> eval("function $name($params) { $code }"); >>>> return $name; >>>> } >>>> >>>> I tried to look on Github what people currently use create_function fo= r, >>>> but with little success. Nearly all results I get are uses in the php >>>> testsuite (copied over to various projects). The only other use case I >>>> saw >>>> was in conjunction with the WordPress add_action() function. In this >>>> case >>>> the create_function call could always be replaced directly with an >>>> anonymous function (i.e. it didn't need any magic create_function >>>> capabilities). >>>> >>> 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 >>> >>> -1 for removing wrappers/abbreviations/and such >>> +1 for bug fixing >>> >> >> I think you misunderstood Nikita's proposal. >> "all these lines" can be put in a library and your code would just >> continue to work the way it is. >> >> Idea is that it is trivially implemented in userland and there is no muc= h >> sense to keep it in core. >> > > It is possible to write most of the array functions in plain php with a > trivial foreach. Can't see the point. That doesn't mean, that it was useful to include some array functions into the core. For example I still don't really get, why it was so important to get "array_column()" into the core, whereas it is _really_ trivial in PHP-userland [1]. In some cases it makes sense, for example for better performance, but imo it doesn't make sense only for the sake of itself. This said: Saying "but other xyz =85" isn't an argument :) Regards, Sebastian [1] Don't want to start a discussion about that. Just needed an example. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 github.com/KingCrunch --047d7b5dba7ada870f04e901ed20--