Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103959 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64199 invoked from network); 1 Feb 2019 01:59:53 -0000 Received: from unknown (HELO mail-yw1-f53.google.com) (209.85.161.53) by pb1.pair.com with SMTP; 1 Feb 2019 01:59:53 -0000 Received: by mail-yw1-f53.google.com with SMTP id d190so1967983ywb.5 for ; Thu, 31 Jan 2019 14:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XxFqE9l/vLDNUN0swYeyBsrFaPLx7VYgACQyRpTv41U=; b=A3X4KEs6lpVKk/nw73zYRw2THfo6BGEa6CWKkJiuSret6uDQs8ESWtSuvkhdcCz9O5 yH93yfL5Nr862lAdpZy68SbuzPNmhTwowhlxz8UI4+BssjP4ShsJkC0lFP8JIv49U01l epbNRBuG4YvaNLXLs6wzk8HUxU7j5FhrAyB7At6PWNGAoJx0MWZRo7NIkSfEYGnrDdx3 wFsiyrmxF9Z9aAPBTsnCE92SBhLMEdzcjXbqOM6r+GfV9gTSfpHAKpzTziWvlvOHZdZ7 5kaVhs1jVCdyOnWcgy7JgPm3fr4ce0vvu9TsvosOpAtXUm6u1ACONr9VAdCIzw/DH0Lq Bqgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XxFqE9l/vLDNUN0swYeyBsrFaPLx7VYgACQyRpTv41U=; b=KyPwmfI3Bfw132ISgrqvgfM2DnovAhuZzpZ4IxcMkF1CWIiqFuEh32rH0V0RtJ8yH4 Xoo9Yyi4k7oxlisAmc5HHx5TwX5ZzViTfqmpdG20A6M9t47gnALAuRz545gLbvtHG44X sg8UTllrBMVm22CjTcftCt9juprEYnOmz1L9pL8lok1mk+HnMS1HbOyOqtqdlS2ltKpe ufYREq2wI5WjGJpCboVDamBniuzEgGe7RLf2CVxOrcri7xkQNFEg7Hkns77Ek+pZwbjZ YKKmi7xgLbsTGWqRY4fJm+oiTw43R1IEjNTHwDWLZzBO9zlWa5fR1C9yAz9QPAoB6rkj 4RrA== X-Gm-Message-State: AJcUukcFNSDvwKvcDZu14EqXtXmXGjRJDHGOXfsuwR9/VoMxLckH9r7R dPMipfgAccujvHecM6x+WadZYXPI26k93n9AFrg= X-Google-Smtp-Source: ALg8bN7N4Nj1v6XCuNxJRinIp0Fe82Q/uSVjlkRWUdfcwxi/ngbwMSTXD8SJr1d5IjypsaLt8Pu5W5j1+bIn1hbjl1c= X-Received: by 2002:a0d:df4f:: with SMTP id i76mr34954537ywe.222.1548974392165; Thu, 31 Jan 2019 14:39:52 -0800 (PST) MIME-Version: 1.0 References: <0243D3A4-2C15-4B31-81A8-C2E5892913F9@koalephant.com> <2d8efb96-ed1f-28e4-e0fe-603a2d0f1962@gmail.com> In-Reply-To: Date: Thu, 31 Jan 2019 23:39:40 +0100 Message-ID: To: Rowan Collins Cc: Peter Kokot , Internals Content-Type: multipart/alternative; boundary="0000000000006949c90580c8b4b0" Subject: Re: [PHP-DEV] Deprecation ideas for PHP 8 From: benjamin.morel@gmail.com (Benjamin Morel) --0000000000006949c90580c8b4b0 Content-Type: text/plain; charset="UTF-8" > The problem comes if the share using the old names *doesn't* decline enough (and how would we even know?). We can't survey private projects, but we can run automated analysis tools on a large number of open-source projects available on GitHub, and compile statistics from them. I'd be happy to work on such a tool, should it be useful some day. > What if people's muscle memory, their coding standards, their need for progressive compatibility, their tools, the tutorials they follow, the code snippets they copy, all make it easier to just keep using the old names? Then our "deprecation" means nothing, and we are stuck with a long list of aliases to maintain, and people learning the language scratching their heads at inconsistent examples. Deprecation notices. Tooling also helps a lot here: IDEs (PHPStorm for example, strikes through deprecated method names), and static code analysis tools. > To be more positive, I am all for introducing new ways to do existing things in the language where they have real benefits to the user. For instance, a new file-handling API, with better error handling, and object-based streams, would be great; or a replacement for the frankly awful curl functions. Perhaps even a well-designed implementation of "scalar methods" (e.g. being able to write [1, 2, 3]->map($callback)->filter($callback);) would have users enthusiastic enough that they *want* to upgrade their code to use it... I do agree with you on that point: I'd rather offer brand new APIs, rather than just fixing naming inconsistencies. There is so much more than fixing naming inconsistencies. The error handling, in particular, should be given some love, by throwing exceptions everywhere, instead of returning false / triggering warnings. And I would love, too, either your "scalar methods" approach, or array being an object with built-in map/filter/reduce... ... although it takes us close to "completely new language" territory. Maybe not, if this can be done in a mostly BC way. On Thu, 31 Jan 2019 at 12:43, Rowan Collins wrote: > On Thu, 31 Jan 2019 at 10:53, Benjamin Morel > wrote: > >> Please forgive my stubborness, too. I fail to see how WordPress >> supporting PHP versions that have been EOL for YEARS can be of any help to >> the community? >> > > I agree, it probably doesn't help the community; but it happens, both in > open source projects, and in the many private code bases which are written > in PHP. The more breaking changes we make in the language, the *more* > likely it is that people will stay on old versions, where their code works > without modification, and have a negative opinion of upgrades. > > > >> Now what prevents PHP from adding consistent function names / APIs, and >> deprecating the older ones? We can keep the old ones for 10 more years if >> you wish, but at least new PHP code can start using the "correct" ones, and >> progressively the share of PHP code out there using the old ones should >> progressively get lower over the years, up to the point where we could >> eventually decide that it's not worth keeping them. >> > > The problem comes if the share using the old names *doesn't* decline > enough (and how would we even know?). What if people's muscle memory, their > coding standards, their need for progressive compatibility, their tools, > the tutorials they follow, the code snippets they copy, all make it easier > to just keep using the old names? Then our "deprecation" means nothing, and > we are stuck with a long list of aliases to maintain, and people learning > the language scratching their heads at inconsistent examples. > > To be more positive, I am all for introducing new ways to do existing > things in the language where they have real benefits to the user. For > instance, a new file-handling API, with better error handling, and > object-based streams, would be great; or a replacement for the frankly > awful curl functions. Perhaps even a well-designed implementation of > "scalar methods" (e.g. being able to write [1, 2, > 3]->map($callback)->filter($callback);) would have users enthusiastic > enough that they *want* to upgrade their code to use it, although it takes > us close to "completely new language" territory. > > If we can persuade every user of PHP that the change is bringing them a > real benefit to outweigh the cost of re-writing and re-learning, then we > can make grand changes to the language; I don't think moving underscores > around will ever do that. > > Regards, > -- > Rowan Collins > [IMSoP] > --0000000000006949c90580c8b4b0--