Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120591 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47990 invoked from network); 15 Jun 2023 15:09:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jun 2023 15:09:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 24F8B180539 for ; Thu, 15 Jun 2023 08:09:14 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com [209.85.221.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 15 Jun 2023 08:09:13 -0700 (PDT) Received: by mail-vk1-f179.google.com with SMTP id 71dfb90a1353d-47134a7cf57so22834e0c.1 for ; Thu, 15 Jun 2023 08:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686841753; x=1689433753; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IAuXIVnMk6uV73gJRUj+v/gSELsrcrfbFYWUTG5GXiI=; b=UcaPImoMaZdvVyeVPQ/YSh6NCusbU78SQU5SD8OcecLGwG6IDskj9QtGgMcAxocQPr pNYEiY2UOcv8TThrkcTGxvpjvN5QyP+SQFcTx25Z/dbGrLEYeJhE8NZTnwJhjAh5EUut meUeZJzxRVfTaKDtUokdUYhZltubFeXo3gl4mhijrKJ/WrXsCi361QveZ7sSI/EN2C0l IAq9bKfIOpQOxmnRVA1HlnY4TAju1EKOaYFI1Ysr2FCWndv2qpVbk5VPVCBsrSS3XxYH akPHRrqL7xf20sX1hVE60yRJr7huy68LL6dKuQhgtBH4lbQ3lxNcskA2hfttXmmsJ6pY hTkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686841753; x=1689433753; h=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=IAuXIVnMk6uV73gJRUj+v/gSELsrcrfbFYWUTG5GXiI=; b=XkTL2ExLOhknX78Flpl+ov+68ghCh7MXJW59DqgeoEcAPmyVLGInmVhbzlbZVkaUks X+0+4NbPEixYTrRMl/hQQyYBJyiJTAKcvkQYjwkYIcuFjS1ec8376U7TP33hMSVA2Qb2 9jm59W383ZscepYigVyRDxyk8VPB07i7RVrVmAevrGucCGXHMdjwLwTd6utTTy6byw1X KbfW6LfNo1XuRB9v3mCt8/H00sxXtj5P+pGJ+JUQLoLpjf+5UpOH5P20sRc9adlVA4IV 6biNBNYg8KabkXlnLNOTeAspjLTBOB9hKwiTxOTKQMSyHPZp4VLiEhmCVaJ3z12otT9M 1CMA== X-Gm-Message-State: AC+VfDyGU3KkecDbxC67Pes0hv82mFaLJOuPEyEkVHQEdCXmBbTn6Tor RE5Ri2rnaiRsLCKBQq8AI1PCZKLAQIxrH6m/6hCiMnDzyO4= X-Google-Smtp-Source: ACHHUZ4a5DVjhhyAjsxVEbfWfug8xCc+Nb4b+uovYXvMBhABj+HMF6N57H7VNFM+vlFKkY3iVRPh5KARKUs6tviHHRI= X-Received: by 2002:a1f:198c:0:b0:46e:7d97:6153 with SMTP id 134-20020a1f198c000000b0046e7d976153mr3844694vkz.0.1686841752516; Thu, 15 Jun 2023 08:09:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 15 Jun 2023 12:08:36 -0300 Message-ID: To: Levi Morrison Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000737d2a05fe2c737b" Subject: Re: [PHP-DEV] [RFC] Interface Default Methods From: deleugyn@gmail.com (Deleu) --000000000000737d2a05fe2c737b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I loved the proposal and I think this has the potential to be a huge developer experience improvement, perhaps at least as great as property constructor promotion and match(). Just a side note though, in the Backward Compatibility section, I would think that only "None" should be declared. From the PHP binary perspective, running code before and after this change has absolutely 0 impact/breaking changes. The feature may introduce a new way for *Users of PHP* to break BC with *Other Users of PHP*. The language change itself has no impact on PHP code written prior to the feature. The additional note about how users may break BC by using the feature would be a description of the feature itself, thus might be best declared as part of the Proposal instead. I wish us all the best of luck with this proposal. On Thu, Jun 15, 2023 at 12:48=E2=80=AFAM Levi Morrison via internals < internals@lists.php.net> wrote: > Hello, PHP Internals, > > I am moving my RFC for interface default methods to discussion: > https://wiki.php.net/rfc/interface-default-methods. > > This can be a useful tool for a few reasons: > 1. It can make implementing an interface easier when certain methods > can be implemented by other methods in the interface. For example, if > `Countable` had an `isEmpty(): bool` method, it could be implemented > by doing `$this->count() > 0`. Of course, if an implementation can be > more efficient, they are still free to implement it how they want. > 2. It can mitigate BC breaks in some cases. It's somewhat common for > authors to want to expand new methods onto existing interfaces over > time. Although this would still be a BC break, it moves it from a > massive change (every single implementor must add something, even if > it's a stub, or it will fail to compile) to a naming collision issue > only (only classes which already had a method of the same name will > fail to compile). > > There is prior art for this feature in both Java and C#. There may be > other languages, but I was aware of at least these. > > Note that the RFC links to a partial implementation. If there are two > or more interfaces with default methods of the same shape (name, args, > etc) and a class implements both interfaces and doesn't provide a > concrete implementation, which default implementation should be > chosen? There is a proposal for resolving this in some cases which is > modelled after Java's implementation, but it isn't implemented. > > Thank you for your time. I look forward to productive feedback. > > Levi Morrison > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --=20 Marco Deleu --000000000000737d2a05fe2c737b--