Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119589 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44271 invoked from network); 21 Feb 2023 13:30:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Feb 2023 13:30:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4399D180556 for ; Tue, 21 Feb 2023 05:30:51 -0800 (PST) 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, 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-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (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 ; Tue, 21 Feb 2023 05:30:50 -0800 (PST) Received: by mail-vs1-f44.google.com with SMTP id f23so4148717vsa.13 for ; Tue, 21 Feb 2023 05:30:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1676986250; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=K4GR85rtgvA6clhhgbRb2rgDB5pw0abgNYNg2EPCUVk=; b=fFUiknUzIPLPP7+tprwB+r6yqX2RIrQkmQM+GfH6BCvooDOdhCpRW3doB1yyMLvLr0 bS0Vx6ak5V0NYOctbiKjDkPvzw57GreefPdOWOrKBwXsCXHfyetSxTua+QxN70B0xLGI gHyew93AijBCinKmikt4CSaDpxBlIlCkl7RCGnCpFtON5iMj0oAhm7rPnXKNCxDG0EoF DkY7G5yrP2o1EueEfuT8V3W4C6+HHx2VmDjKiPtJcC5Ws2TPq9z3Sm3TVPxubWdIGbAo k/Nm6AfzJQBB4iRT7uFCZy/ixI3kjRFTjW0FNwaP/W9NctSE2NnWcyMmvZCjiRrag0ev cFpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676986250; 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=K4GR85rtgvA6clhhgbRb2rgDB5pw0abgNYNg2EPCUVk=; b=yzeyODoZSjhIZQ+hETYnXmtzTZGpA2cJiLhxqzN5WdjyEC/DDccYwIPFT4Xn/BW6dR KTSqoaM7FaE/3jauJ1LmIaw8tT8gaymDujkiOxqDUBDXMgs9G2wgE9AmeHDovV6dGJAY /A9JGVJ30oCahETfNfjQ6RUPGGicrtL4i1u35c6qm/bVVHAVGQ1hHFMdpEp5G+PXZhZs PM2BAjKZpN+huiDUZY8T7x++PNcU3ZqTk0KcL55iTYA4TLuVptlA60Y/o6T06TobwSs8 B0ohpy4LeBMHen1mphPrb3BvKnU6ydQsYAvw/UwlivIQft47LI7VApwEmUlCogKRB8Lq Jnbw== X-Gm-Message-State: AO0yUKXsOQ8FZjsE/Y84FuAgoSnAz6lZkXmWENkchtWruMssV5UNAY1o xHTTus9Bj2QEPY/8Yjx2oKZUMCnj+7jUpcty01SBL9br8QpOOGoQ X-Google-Smtp-Source: AK7set+QBy16iMAvS3rgD/MTAcFPIjWDhsbiIe5lU2oVbVoP+pfMbpT3nu85dQ9ELZDTDPs6XOydDVfY2ysO79q4VMU= X-Received: by 2002:a05:6102:2367:b0:41e:9598:e126 with SMTP id o7-20020a056102236700b0041e9598e126mr324439vsa.66.1676986249928; Tue, 21 Feb 2023 05:30:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 21 Feb 2023 15:30:38 +0200 Message-ID: To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Class Re-implementation Mechanism From: someniatko@gmail.com (someniatko) > This sounds interesting but it breaks some expectations. > > Interesting because you can have any class act as an interface for other classes with the interface being built up of any public properties or method that exists on that class. In my original suggestion, it's not like any class, but only those you specifically mark as `class interface`, not just `class`. Closer to the end of my idea I also suggest that maybe it's worth it to allow implementing, like interfaces, ANY classes, not only those specifically marked with the new syntax, but this indeed brings up some issues. > Ok, maybe not any class but just a final class. I see no issue there of allowing to reimplement the interface of a non-final class. This still is better than extending from it IMO. But we _probably_ should prohibit it from abstract classes. > And also maybe just a final class that doesn't yet implement an interface. Also, here is no conflict as well. When reimplementing the interface of the class, you can treat it as a normal interface - which can extend from other interfaces. > The expectation it breaks is that if you have a final class, whenever you use it, you expect some specific implementation exists on it. > And this would break the expectation and in real life someone might pass a totally different implementation. > Will not break generic LSP but still will break some expectations. That's why a new syntax is brought up. This expectation might indeed break if we allow to reimplement any existing final class, instead of requiring a manual opt-in. (sorry, this email is sent to you the second time, Alexandru, because I forgot to reply to the maillist as well) Regards, Illia / somenitko