Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107200 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45653 invoked from network); 18 Sep 2019 13:34:50 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 18 Sep 2019 13:34:50 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 191792D1FAB for ; Wed, 18 Sep 2019 04:12:12 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Wed, 18 Sep 2019 04:12:11 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id z67so7507634qkb.12 for ; Wed, 18 Sep 2019 04:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vCBb7eC0edONtHQJo7hb2kgIZhIDWfV66+NyTBY+PMg=; b=UdNroV5xbKuby8QHno+AIVxP9gwp+e4bQ3g/nXSCNp3nSvhGJhKmfv/ahxn5w5/tY4 Yfp6JOwWyp9s9nZz1MnL1BdMD22DusSoehjGiGQ+9p+7yc/P+XSsuF5Z+pRUx6+BjMxB Myb///xwCHxYR7gCVL9L53HzhAxFp470U9cOzfAdK6OrS9tn7ah+5AVcLShRI78144dj nhxMHDBcrGDNPUij2aUjXVRp0hvPQTwYHV2riwzccg9mPVuUuCqkbTANCZpL5nGM87zm DbI2qV2LoBeeL22pNZXgMksHPDNErXPZggdfdwXcDYgI4pMBFCTWKjrkP8rzTcq5Odpb Uy9Q== 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:content-transfer-encoding; bh=vCBb7eC0edONtHQJo7hb2kgIZhIDWfV66+NyTBY+PMg=; b=jv2iISvl9QMTE8ai1yVRfzzS/j/0vdzjMloYe+AG1zJZEt7utxqyT4q4JLPYr407+z MJam7AbdUf5l6DmKeKgQPKHDNzkgdyPZoc7/kDus/uFbH4BlQy5qB5EYE/5Qxif26ZhQ /txWEiGNyhnwXCIw+NpcB5uFyrVw8zNu6XPMjZLC8s1bFhIvyNi1onuApsbYsLJwvay4 27/UDMoeygcsFho+d4YEQZWmQ+lq5iTgD8q+JIJAhDUEWHC3OUaa//i175yZibqA34bf 4RaGeWIT8ixpyzUMjuJZvfYmz8+7zS98g6jW26ADxEjvYFgAegyOaslsZPlh9dq9Re5w 0H2A== X-Gm-Message-State: APjAAAVQrG5N/hUXNZmTpjKpaukBwDgs0ErGnAg1Fc4LDeDNcZx6+IJI jgWvjZ7i5nEwUXvuK5LCCAOSzefw7vI= X-Google-Smtp-Source: APXvYqy+k/QofdUloIet8nRQlUV8cjGGOHJzlF0xCzbZAe5BNq3R1camEtbZOudUujSPHWxNWRHcDA== X-Received: by 2002:a37:b601:: with SMTP id g1mr3442644qkf.30.1568805130728; Wed, 18 Sep 2019 04:12:10 -0700 (PDT) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com. [209.85.222.180]) by smtp.googlemail.com with ESMTPSA id z200sm3059724qkb.5.2019.09.18.04.12.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Sep 2019 04:12:09 -0700 (PDT) Received: by mail-qk1-f180.google.com with SMTP id q203so7589512qke.1 for ; Wed, 18 Sep 2019 04:12:08 -0700 (PDT) X-Received: by 2002:a37:624a:: with SMTP id w71mr3343966qkb.456.1568805128687; Wed, 18 Sep 2019 04:12:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 18 Sep 2019 13:11:57 +0200 X-Gmail-Original-Message-ID: Message-ID: To: jmquarck@gmail.com Cc: Nikita Popov , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Envelope-From: Subject: Re: [PHP-DEV] Adding return types to internal methods (PHP 8) From: andreas@dqxtech.net (Andreas Hennings) I am not a voting member, but I agree with Sara Golemon. This is just too big a BC break. I had similar questions in my own projects, and always chose to find a solution that does not break BC. The strategy was: - Keep existing classes and interfaces stable. - Introduce new classes or interfaces if I need to change the contract in a BC-breaking way. - Where possible, use inheritance to bridge old vs new. Interface Named { function getName(); } interface NamedV2 extends Named { function getName(): string; } This can lead to namespace clutter, but it is the responsible thing to do to allow sustainable evolution. The "*V2" suffix could be replaced with namespaces, e.g. "PHP\\8\\Named" vs "PHP\\9\\Named". Then perhaps there could be some magic to make all symbols from "PHP\\8" available in "PHP\\9" as well, even if they are not overridden. -- Andreas On Wed, 18 Sep 2019 at 11:00, wrote: > > Hi internals, > > I appologise for writing here without warning, and without being an activ= e > member of Internals. But I did not find any other public way to fairly > contribute to the conversation: externals.io, though is claim ("opening > #internals to the outside") is actually closed, and writing a blog post o= r > a tweet thread looked unfair to me. > > About all these RFC discussions and the PHP evolution, from the outside i= t > seems too petty. In my opinion, PHP lacks of the ambition to pursue a > long-term vision. Any vision would be far better than having none. > Otherwise you just write code, which is actually your job, but without > meaning. What kind of language PHP would like to be? Having a purpose to > accomplish would facilitate RFC priorization, and pull more implication > from people. > > A clear mission, a narrow focus, does not necessarily mean a narrow featu= re > set. Python is an example for this: they decided to fight against Go for > its prominence, and they achieved spreading Python features to data, to > asynchronous, etc. Plenty of old Python contributors recently mentioned h= ow > impossible has become for them to keep on track with all new features > Python provides now. In comparison, PHP walks like the elders. > > PHP RFC's may stay as a draft, or under discussion, for years. In 2019 th= is > looks is demoralizing when the whole RFC process should be invigorating f= or > the community. > > My claim is for you all to leave aside these minor disagreements and > discuss, internally as well as with the community, what that mission migh= t > be. PHP has strengths no other general purpose language has, why not > leverage them? > > Actually, this is not the topic for my writing here, but I also suggest > spending some time, or appointing someone, to improve this whole > communication toolset: it is old-fashioned, and stops contribution. > > > Best. > Jordi Martinez > > Missatge de Nikita Popov del dia dg., 11 d=E2=80= =99ag. 2019 > a les 10:44: > > > Hi internals, > > > > Something that came up in the arginfo thread: We can now add type > > annotations for everything, apart from return types on methods of non-f= inal > > classes. > > > > The reason is that adding these return types would require inheriting > > classes to specify them as well. The same problem does not exist for > > argument types thanks to > > https://wiki.php.net/rfc/parameter-no-type-variance > > (which is exactly why we wanted that RFC). > > > > For example, if we add a "string" return type to DateTimeZone::getName(= ), > > then any userland child of DateTimeZone would also have to specify a st= ring > > return type. > > > > The good news: Userland classes can already specify those types *now*, > > because adding a return type in a child class is legal. This means that= if > > we add those return types, userland extensions do not have to bump thei= r > > minimum requirement to PHP 8 when adding the return type: They can stil= l be > > compatible all the way down to PHP 7 (or 7.1, depending on the type). > > > > What do you think about this? As we are currently annotating everything > > with types, and we're at a major version, this would be the ideal time = to > > make this change. But there's certainly a BC break here. (And, for the > > record, this is not the type of BC break where P++ or editions help, > > without creating a larger mess.) > > > > Regards, > > Nikita > >