Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120792 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35807 invoked from network); 12 Jul 2023 04:01:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Jul 2023 04:01:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9AA7D180511 for ; Tue, 11 Jul 2023 21:01:04 -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_H3,RCVD_IN_MSPIKE_WL,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-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Jul 2023 21:01:04 -0700 (PDT) Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-6b7541d885cso5193330a34.3 for ; Tue, 11 Jul 2023 21:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689134463; x=1691726463; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=loVM4C/syzQOIdlbJmZf4pY0Yvftjb+rREjffd0OQfA=; b=S3X35oyW4GpR+U8yw/oOSKCsnEd/7VsuQVmx7HsTotlzrtKpFJ4yREn/T+UpPWH8c+ BwYofGHt2zV4KbLkBnZywzBuNnAOnvf1gQsk/DTQVTWW7SdFsKYn5SYTCowSJBur3Umz z4TRbwY726zDqvFkg3A99CXhciHfETHDDoFltypKpLcCp1caisozX5Vj7V8rLqZFCR08 0FX2yzDvQodx8YVbSeSkiaL1wmZ7HfYUEGsnKfmTH/xhU13Otq1/kkNUlbZ9oLBGnSMD tLPv13Z/ft0guKGkOaSrKnq8606cWbshhOeQNRuShfcUi913gvuqwGYIenhg+9245TR5 lyYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689134463; x=1691726463; 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=loVM4C/syzQOIdlbJmZf4pY0Yvftjb+rREjffd0OQfA=; b=d/vP4SfGk/RwhOffG5akTydueYB4oQHvyjGG3IjwHx+gHoKFd46mnfmuyj1T0al2vX j6ETILbsjwOpxPD0PAqNCGJ03RokZ+5EVUCg4Jq4ylXbhKvKxPMKroAJEFvEi2YhlG+4 N5Z+8f/E70ahq6hLK5a+EbuW02dPABw4j1LeP8hS0oS6gFrXIWoOQAcsvuetAZYmz5hB Fq9/preGz2JU67mjT3/RKhnIq3rMKzxAD5Smi1noOYfVol8AmV3QBCP13Ho61bgLAnDc z16etXYIwRpf21VdXSxPnKW8B7LINMeMm5WTyZDzo9EpAX8mVPmBep0YWUR/gokGeolT BaNQ== X-Gm-Message-State: ABy/qLaTTneBZwi5LbJD5vKmZbp+Fz0v4JqBgLoybLroZO2Y9hAo7Sua fujbTU3+aVaI6D7foiopK3Uc8NHR0C0t311EFKVv8Id8jXE= X-Google-Smtp-Source: APBJJlG5toTvi+H0fDq8JT7mVAjYIaooOuc7khwa/bEdfqU6K64NhlaS0EAKgr+HCBxlDsixjoldlxZDha/44kUURUw= X-Received: by 2002:a05:6870:c115:b0:1b7:2dfe:c323 with SMTP id f21-20020a056870c11500b001b72dfec323mr7615001oad.18.1689134463532; Tue, 11 Jul 2023 21:01:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 12 Jul 2023 05:00:51 +0100 Message-ID: To: Levi Morrison Cc: internals Content-Type: multipart/alternative; boundary="000000000000ad41730600424346" Subject: Re: [PHP-DEV] [VOTE] Interface Default Methods From: george.banyard@gmail.com ("G. P. B.") --000000000000ad41730600424346 Content-Type: text/plain; charset="UTF-8" On Mon, 3 Jul 2023 at 01:11, Levi Morrison wrote: > Chatter on the [Interface Default Methods RFC][1] has been quiet for > the past 6 days, and the feature freeze deadline is fast approaching > for PHP 8.3, so I'm moving this to vote. It'll be open for two weeks > as usual. > > Thanks to everyone who discussed weaknesses in the RFC during the > discussion phase. > > [1]: https://wiki.php.net/rfc/interface-default-methods > Although I like the idea, I think the main reason for the pushback is how close this is being voted on before feature freeze when the RFC + implementation was updated very recently before. And personally I think, considering this, I would also delay implementing this. We have at least 2 other major RFCs that are being pushed back (Property Hooks and Function autoloading) due to time constraints. Maybe it's time for a more meta discussion about the absurdly long release process PHP has of releasing many intermediate versions that seem to get no testing from userland. For everyone against this feature, I would urge you to understand the distinction between "type classes" and Java-like "interfaces" (which is effectively what PHP interfaces are). A good article is the following one: https://diogocastro.com/blog/2018/06/17/typeclasses-in-perspective/ I also find it baffling the lack of understanding around this feature. Generic programming exists, and it operates on a level where a method can have a "concrete" default representation and still represent the genericity to its fullest. Examples have already been given, such as the Comparable, Equatable, or Iterator type classes. Considering, Haskell, Rust, Scala, and modern PL theory sees no issue with that, I struggle to understand the resistance here. Moreover, saying this capability should not be added to PHP because we have inferior tools X + Y + Z to achieve what this does is counterproductive and, IMHO, shows a clear lack of understanding of the issues PHP's model currently has. Traits are, and have always been, terribly designed. Assisted copy-paste that has no relation to the type the implementation it provides fulfils. Abstract classes allowing default implementations, but enforcing hierarchy thus type relations, meaning they are unsuitable for when one wants genericity (for separating concerns). Interfaces which allow the creation of new types, but no generic implementation which depend on a function specified by said interface. Objectively, the current situation is suboptimal. Maybe the resistance to the proposal would be far less if the RFC, and implementation, would check at compile time that the default implementations only rely on known existing functions available to the interface. Or that at least one of the methods would remain "abstract". However, that does not seem what the discourse is. I find the Rust Seek trait(/type class) a very concise example of the usefulness, and where the implementation of a default method is far from concrete. Requiring an implementation to provide the implementation for seek(int $position) But being able to provide the trivial implementation of rewind() which is seek(0); Sincerely, George P. Banyard --000000000000ad41730600424346--