Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54423 invoked from network); 21 Jun 2016 17:38:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2016 17:38:06 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.164 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.164 mx208.easyname.com Received: from [212.232.25.164] ([212.232.25.164:42894] helo=mx208.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/81-43024-A7B79675 for ; Tue, 21 Jun 2016 13:38:05 -0400 Received: from cable-81-173-134-219.netcologne.de ([81.173.134.219] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bFPcP-0004Xg-EF; Tue, 21 Jun 2016 17:37:45 +0000 Reply-To: internals@lists.php.net References: To: Jordi Boggiano , internals@lists.php.net, Stanislav Malyshev Message-ID: <2f92fa26-5f50-0e68-c1fc-de79f17c201e@fleshgrinder.com> Date: Tue, 21 Jun 2016 19:37:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="V6714AQPTPMwnXUBKM9t6ok1V18g1Nfnd" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] RNG fixes From: php@fleshgrinder.com (Fleshgrinder) --V6714AQPTPMwnXUBKM9t6ok1V18g1Nfnd Content-Type: multipart/mixed; boundary="Gnqc9lwKUbnalau4bkOm5GE52uS9QgUmG" From: Fleshgrinder Reply-To: internals@lists.php.net To: Jordi Boggiano , internals@lists.php.net, Stanislav Malyshev Message-ID: <2f92fa26-5f50-0e68-c1fc-de79f17c201e@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] RNG fixes References: In-Reply-To: --Gnqc9lwKUbnalau4bkOm5GE52uS9QgUmG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/21/2016 11:41 AM, Jordi Boggiano wrote: > On 21/06/2016 06:33, Stanislav Malyshev wrote: >> Hi! >> >>> Why do we need so many functions to get a random int anyways if we no= w >>> have random_int()? I would like to see all of them deprecated and >>> removed in PHP 8.0. >> >> I don't understand this drive to remove functions and break existing >> code. What is the point of it? If you don't like them, don't use them.= >> They can share underlying implementation but there's absolutely no >> reason to remove functions unless they do not work anymore, broken and= >> can not be fixed, etc. >=20 > I agree that removing such widely used functions should be done > extremely carefully, but marking them deprecated might be a good idea i= f > there is a stronger alternative available. That way we encourage people= > to migrate, and at some point (PHP 9, 10, never, who knows) maybe they > are unused enough that we can remove them safely. >=20 > Same with magic quotes and such, it took 10 years, but they are finally= > gone. >=20 > Cheers >=20 I don't understand the drive to holding on to obviously faulty stuff. Nikic proposed already to deprecate rand() and I am only saying that we can go one step further and implement pcg_rand() in favor of mt_rand() and deprecate mt_rand(). Probably not something we want to do in 7.1 (because PCG needs some more time to mature) but something that we might want to do on the road to PHP 8.0. Deprecation is not the same as "simply removing and breaking all existing code". It is just a deprecation that usually means a log entry, if at all. Removal does not mean that we need to delete the code and get rid of it forever. We can move the functionality to PECL and/or supply userland polyfills for users who do not which to upgrade. Where is the drive coming from? Simple: getting towards a cleaner language that does not include cruft. Cleaning APIs is a totally normal process. We just need to do it carefully without BCs within minor or patch versions (which would now allow me to make a potshot right due to some other RFCs) and without introducing too many for the next major version because it makes upgrading too complicated because too many LOCs need to be touched in order to upgrade some software. The var keyword was a good example of something that can safely be deprecated and removed later but the rand stuff here is too. We already have alternatives available (public, private, protected for var) (random_int and mt_rand for rand) or the ability to implement good alternatives (pcg_rand). The general community that is actively developing software is already trying to get rid of the usage of both (var and rand) and is only using mt_rand because there are no other alternatives available (random_int was introduced with PHP 7 but the community has developed a polyfill for themselves). I do not understand the fear to deprecate cruft or badly designed stuff from time to time. I am working at a big company that has a lot of legacy PHP code but we are not afraid to actively invest into making it better. We were actually one of the first big players to change to PHP 7 and this was even shared by Rasmus on his Twitter account. Yes it is time consuming, yes it takes man power, but we are willing to invest it in order to see increased performance, security, testability, and readability of our code since our code is what makes our applications and our applications is what makes our money. In the same vein, searching for PHP developers is a hard thing because of all the various complains that we all know of and are already fed up with. If we would just start addressing those issues things would change over time in this field too and at some point it is as easy as finding a Java developer as it is to find a proper PHP developer. Sorry for going so off topic but you asked for my drive and that is part of it. --=20 Richard "Fleshgrinder" Fussenegger --Gnqc9lwKUbnalau4bkOm5GE52uS9QgUmG-- --V6714AQPTPMwnXUBKM9t6ok1V18g1Nfnd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXaXtwAAoJEOKkKcqFPVVr0wwQALdLCykEi+JxEtztlmt9wbR6 qjfHoUo/jeJIUz5iYHT98MjhSOpSKH72MXi50cKKEAuucGHq8oDTANIQ1TmR9h/p YP/itCsHEEJibMD96JduCkEVHJdANKPCDIRzJmJRngHPWNgOYq4CMhvUgucpJBFk 9ZrTxtCaeL/sTb78vjwTf4RLmZxtwRuzM4fERsFCyMfw+8bI8KX3hrZkZ8fz2D1p iOxzHBTj4TQOfSG03vKf+BBaCoBrC219htv6AhQaQ6rgyLo6SHIMRNaQMpkpZozx XjSe14qeLHEKeuaYyZy8iucM/Z4nUq9DXLTPT/KdEzxDuPzWo9C2H1q1oQgveLuI elJgupHNwSQMVaLImswA6lz74evhzuG6DzDr4rAzxCafwaWsgGWDF6zVEtdrwII2 D8ile7t3Xy/lJrBRT8+bClQSPWVAgMfeziqV5Dv8deXbzC7Hknu9UAYXNHnERc0A tGdHEMLocxZVEsryZEX8QoqKsKcpjSfxn//HRtiBIRA/HjM8bcIrPBSWVQtoEc0v RTZfcGm5XR6Cwod0ifQiSj8CAu/8AzT3hbYPuz+SRHrGU22bJQ4zFXIXX/LH3OcC ROB8p/SmTZ0bIevFrguW+CzmNO+4zsJM0VVDWmqsbATwsMdoNqnDbeEaIqzAaY7N cu5UBGuzbjWbU6UaKYyS =NmwS -----END PGP SIGNATURE----- --V6714AQPTPMwnXUBKM9t6ok1V18g1Nfnd--