Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121772 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21207 invoked from network); 23 Nov 2023 08:18:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Nov 2023 08:18:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6B353180031 for ; Thu, 23 Nov 2023 00:18:06 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 23 Nov 2023 00:18:06 -0800 (PST) Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-58d18d5c687so287087eaf.3 for ; Thu, 23 Nov 2023 00:18:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700727481; x=1701332281; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kF/zoWQq+Mdsxque8CAVphBH8cvr7NgURySUbQAXhOU=; b=eUzaGLz1dp2dOG2n3YyLVgjE4p6RdWrxezLL76VXCSuSGUtd9prnq6BAsX0mqDljMc HjWm/GGZNg1bmX4USWDn0J/O1V/Un+SLcKURntmu/S/fXmJL35/gEgkb+SvikJjg9wsu 11WT82kwkNfdsDPfwSTnF5SiOYMemeayceOQW2aiC0bRUJyP1BKh3fzGJiFYR8hHX6zG nP770Jgvcv0xiK//Rucy1HbKJ58pnn9DqsTINAZdscCWLiNPokMBV5EFU6f/aiySb95P r7YofVxoapMSWJ1W4bi+k0WxlaBT3wa2Mfcf1F9FKfSTLu1RW91Q1b15qtsKdyK0CgH8 cNbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700727481; x=1701332281; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kF/zoWQq+Mdsxque8CAVphBH8cvr7NgURySUbQAXhOU=; b=EJxqtkhpNFv/v+e5yMVSluRiDrc8BbzSjeCgZYSPYUTiegnb6Axt76+oh9djANbX34 gM5Qnqhv5s9VuoVVIWFN+1/4q5nzfiwKuIpoLWEbC6sFqzXqNxY32XBoXIyLNWXtg71q ZtpRefRVxH3+jNgPSYQKvz0RTGjH3q4vNLOgJ9fs2Vn18o2wdH7Iy2U/85R7AQdIt8Nm yBUvRe8nPwuB4oh0/zducn7qhv7oz+xPlP27bPd5xgZ53A82swCnsT1MgH9Ke9BEa7jM Wg5OzFJ+1Ec8mt2UrIsCnoz6qjzeMYbh8ARXBZEahrGGqmlGky834k7DGbcWgrj25vk4 kEVg== X-Gm-Message-State: AOJu0YxgE3KjpIDivuUtvtyYDTmHSt8Z2Q8uO1NwsWhTzM6+c0CDlmVu vLAUwc6wE1IDYds3MSQqsOvJ5A29VtztlxANbEY= X-Google-Smtp-Source: AGHT+IG9E/V7+XgRf31ZE4QynTn55af5KcbtfHtm68N3309OMEWaxxn0nbuHIZ/lbpu/2b9dZahSOkeg2CG6MtRRsPo= X-Received: by 2002:a05:6820:619:b0:584:bb9:4945 with SMTP id e25-20020a056820061900b005840bb94945mr5460928oow.3.1700727480792; Thu, 23 Nov 2023 00:18:00 -0800 (PST) MIME-Version: 1.0 References: <04DC3709-3B46-41C0-976E-E6AB28BC0D34@edison.tech> In-Reply-To: Date: Thu, 23 Nov 2023 09:17:49 +0100 Message-ID: To: Deleu Cc: "G. P. B." , Mike Schinkel , Jakub Zelenka , =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] Resource to object conversion From: landers.robert@gmail.com (Robert Landers) On Wed, Nov 22, 2023 at 10:53=E2=80=AFPM Deleu wrote: > > On Wed, Nov 22, 2023 at 2:08=E2=80=AFPM G. P. B. wrote: > > > On Wed, 22 Nov 2023 at 07:36, Mike Schinkel wrote= : > > > > > On Nov 21, 2023 at 11:33 PM, > > > wrote: > > > > > > What is the point of a major release if we cannot even do such a BC > > break? > > > We don't even know when PHP 9.0 is going to happen yet. > > > > > > > > > I have been using Go for about four years now and it seems they have > > > gotten the backward compatibility issue nailed, and that pays great > > > dividends in developer confidence in the language, i.e.: > > > > > > > > > > > https://www.reddit.com/r/golang/comments/17v4xja/anyone_face_issues_whe= n_updating_version_of_go/ > > > > > > They recently explained in depth how they do it: > > > > > > https://go.dev/blog/compat > > > > > > Also see: > > > > > > https://thenewstack.io/how-golang-evolves-without-breaking-programs/ > > > > > > Although Go is compiled and PHP is not, I think there still may be > > > significant insight that can be gained for PHP by studying how Go is > > > handling it and applying any lessons learned. > > > > > > > Go is a "new" programming language, with its 1.0.0 version being from 2= 012. > > It was also designed from the ground up. > > > > PHP on the other hand wasn't designed, but the language grew organicall= y, > > and is 28 years old. > > Comparing it to Go, in my opinion, makes no sense. > > > > We should be comparing ourselves to languages of that age or older, the > > most famous example being Python, which did a major BC break between it= s > > version 2 and 3. > > But Fortran, C, Perl (with Raku), and for sure others have all made cha= nges > > to the language, recent or not, that break compatibility. > > > > Go even has a cave out that they *may* release a Go 2 specification, wh= ich > > does not guarantee any backwards compatibility with Go 1. [1] > > Even if the current lead engineer says this is "never" going to happen,= the > > cave out still exists. > > > > More importantly, it is possible to write cross compatible code, even > > without changing anything about is_resource(), if we convert streams to > > opaque objects. > > It might be tedious and one might need to have redundant instanceof che= cks > > with is_resource() if one does not want to check for a false return, or > > duplicate checks for closed resources. > > But it is possible, which was *not* the case for Python 2 and 3 as it > > changed fundamentally how strings behaved. > > > > Finally, I think people would have more confidence in the language if i= t > > stopped coming with various foot guns included that need to be explicit= ly > > kept in check by using external tools such as static analysis tools, or > > code style tools. > > And removing those, or making the language overall more coherent and > > consistent, requires us to break backwards compatibility. > > > > Sincerely, > > > > Gina P. Banyard > > > > I sympathise with both sides on this topic. As a Software Engineer, not > breaking 10-30 years of BC promise is unsustainable, but as a PHP user BC > breaks have a heavy impact on legacy codebase written 10~20 years ago. > > A lot of discussion has happened around this subject, but unfortunately n= o > consensus is ever reached. I've talked about increasing the stability and > the pool of maintainers by providing PHP Packages under PHP namespace ( > https://externals.io/message/120335#120354). There were a lot of > discussions on language evolution and editions that ultimately didn't go > much further. > > Given how much time has passed and how this subject is always present, I > now look at this with the optics that both PHP internals devs and PHP use= rs > suffer from the same condition of dealing with legacy. Between 1990 up to > 2010, give or take, the way software used to be built vastly differs from > how software is built today and these old software can be very hard to > decommission given their lack of automation tests and inability to be > statically analysed. With today's practices, I believe it's easier to > introduce BC breaks that affect software written after 2018. And since I > believe that, it's a natural consequence for me to believe that if PHP > introduced a new `declare(backward_compatibility=3D0)`, it could be used = for > users to signal to the engine that 1) we're writing this file after 2023 > and 2) we will cover this file with automation tests and/or static analys= is > tools. PHP Internals wouldn't need to make a huge big-bang BC break > all-at-once. Every year new BC breaks could be introduced affecting only > the "new engine version". The idea isn't to build several combination of > "PHP Editions" as it was discussed in the past, but rather to have a > consensus between PHP Internals and PHP Developers that a new Engine is > constantly being developed, this engine will break compatibility with the > past 20 years of PHP whenever PHP Internals manage to rebuild something > (throughout multiple versions), a migration path assumes users will use o= f > Rector, Static Analysers and PHPUnit and the old engine keeps the BC > promise in order to allow old software to keep running, but is expected t= o > degrade in performance and to only support new stuff if it has no added > burden to internals. > > When such assumptions are made about userland, the concept of what's an > acceptable BC break should be skewed in favor of helping PHP Internals. > > -- > Marco Deleu Hey Marco, I think the biggest issue with that strategy is that you end up endorsing projects that PHP cannot control. This may not be a bad thing, but personally, I'd love to see PHP start adopting these kinds of projects as officially maintained by PHP. For example, composer could be forked or brought over to the PHP organization and then if PHP wants to change how autoloading works ... they can just change it and implement a migration path in composer/rector/whatever. All these tools maintained by volunteers over the years would benefit from being able to have important conversations before a feature is even developed; even be able to suggest changes to the feature that would allow for seamless migrations. Imagine installing PHP 9.0 and then just running `php --migrate-from=3D8.2` and having it run rector + composer (maybe even static analysis before and after to give you issues) migration scripts on an entire codebase. Right now, you need to know what to do and how to use it. You may not even know these tools exist or what to search for to find them, particularly if you are new to PHP. Robert Landers Software Engineer Utrecht NL