Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69667 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17779 invoked from network); 18 Oct 2013 10:51:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2013 10:51:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.182 as permitted sender) X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-lb0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:33842] helo=mail-lb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/D1-06505-AA211625 for ; Fri, 18 Oct 2013 06:51:23 -0400 Received: by mail-lb0-f182.google.com with SMTP id p9so3021579lbv.27 for ; Fri, 18 Oct 2013 03:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=h7C4Uw2xwINaxpbaDq4mt2bEUB1ccNIINsISyB3olYw=; b=S4tWPK7yrNd5vLCT4h2gKrQHr2TIhoB6ieqcLu8MaNf2g+FaYAnBLG8LBRF+FeZeSB IL5Kx14cS+NuhKOmEjRGQncNCZu7BBWAbvZYMYMcE0oKCyR8GzsALZ8kvEYzES+64hTq 0Y8hcLb9q8n3EuRz8EDDRiceykIecOAvec1xBeqogLi55+E9iSg+3NkQeibxw4twDmV+ WTDBOFZcisxeWoLGNplHbtFw2aO70aL8mo0HaLf1X2TsQM2LJf1349gDmY5ufnBbc6Lk ibcfckCHCPSH/PBrAwkJn+MONEb6ZDjtt7/oYPJpwTNd3Z1gij0EywPYNeJgCt/9KnDe ZNJQ== X-Received: by 10.112.234.168 with SMTP id uf8mr1023295lbc.35.1382093479560; Fri, 18 Oct 2013 03:51:19 -0700 (PDT) Received: from [10.0.1.24] ([46.252.161.106]) by mx.google.com with ESMTPSA id ap7sm1011574lac.10.2013.10.18.03.51.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 03:51:18 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_2486539F-4012-4D86-B48F-CEC69F62D033"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) In-Reply-To: <52610FFE.7020806@googlemail.com> Date: Fri, 18 Oct 2013 14:51:07 +0400 Cc: internals@lists.php.net Message-ID: <327CCB6F-3D5B-410E-84BB-547467E688B1@gmail.com> References: <525C631E.1050008@gmail.com> <52610FFE.7020806@googlemail.com> To: Crypto Compress X-Mailer: Apple Mail (2.1510) Subject: Re: [PHP-DEV] Proposal to deprecate create_function() From: indeyets@gmail.com (Alexey Zakhlestin) --Apple-Mail=_2486539F-4012-4D86-B48F-CEC69F62D033 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 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): >>=20 >> function create_function($params, $code) { >> static $i =3D 0; >> $name =3D "create_function_" . $i++; >> eval("function $name($params) { $code }"); >> return $name; >> } >>=20 >> I tried to look on Github what people currently use create_function = for, >> 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). >=20 > shure all things can be replaced with more and verbose code. What is = the benefit of writing all this lines in contrast to one method call? > = https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/Console/He= lper/PhpcrCliHelper.php#L111 >=20 > -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 = much sense to keep it in core. --=20 Alexey Zakhlestin CTO at Grids.by/you https://github.com/indeyets PGP key: http://indeyets.ru/alexey.zakhlestin.pgp.asc --Apple-Mail=_2486539F-4012-4D86-B48F-CEC69F62D033 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEcBAEBCgAGBQJSYRKjAAoJEMkJcRxZdR27vfAH/j5kyf31SlI9it/DSgX+4kMr QagxUHokEYEX/0BoA/J+dhnDYZR056R9j4QBDTvGKFXDe8BHJ1UbmF3WfZJDdEeu a5tGBhyNbhA7HLVjVTfWH2yTseBqR60mLq/Prkj9jnmtNdYf2LDYH+c2hSTQXCjJ wqOXXTPxu/9SkMatU+ZRWdbFwX/W7Do6pceXcDIWIUR+3ThxHfAM928QHrwdTQLi gYW5XJ7QPjDQlyZ8FnnM02F/FXpqOf1CLe1Xtm8vxPQJa9gLVW44Qx13IY/C9zHw QnnQag9t5lyDhbEPBRq/rciPXa5ZQJNOth609ynyFhfdcfTznnnL9gmAkVeAUHA= =eQOl -----END PGP SIGNATURE----- --Apple-Mail=_2486539F-4012-4D86-B48F-CEC69F62D033--