Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114213 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21011 invoked from network); 27 Apr 2021 19:03:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Apr 2021 19:03:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F29DE1804BD for ; Tue, 27 Apr 2021 12:07:41 -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 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 27 Apr 2021 12:07:41 -0700 (PDT) Received: by mail-vk1-f173.google.com with SMTP id n74so502762vkc.6 for ; Tue, 27 Apr 2021 12:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tvOz1VxGnJ9OsJejv4xNO4BR4jSGhnE0PlRcxCO0IO4=; b=NEHBTlhiTm2D0WNqIzMSA6o2ZDBN9CsU+jPust6547vPYv9sZE/7iruuroy+3pKCZA ghqzeyhYpN0wzfYlaeDjh9mzHYx0bS9bQQPzJse/wiamLbeG1dHwtvVULQQINZybJhWT dRFMr2pduOusJpGkB8ldwrIOxT2hcv4W1RAdr5sukZY0qB9A9AeLABsg0d/mUZ9jUYhH eYuNCAj033ql06hqyC2FKBgoxxY+tUAUsX7FFZiLi/6zlzHSK3LBI/fHK/oNe3hTOVMC RXTzOjwkeE1L3TFFzuB82rmbmBCQ4s0GvzH128rUg2M2/TUTruQ85Coqf/V31kaVKg9O 5IpA== 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; bh=tvOz1VxGnJ9OsJejv4xNO4BR4jSGhnE0PlRcxCO0IO4=; b=qNLK9fBLqY/7dh2ta6Xh3l0Zx8Ufo69t58E8y9BGLNrXcEGz0dieSF789eeQHI+T7Q g9hFXw/Tky9DqkUTSymPORDXX6CPejb2gSJkmbkVILyFm+rj1yAqIRL5T8il2hOgGk8T DFaJRSIScUpqLpvEB0myzazGQc+DRVQTaRV8ciAdW8/MCoLCnPdZGjyziqvDKLhRUhgr WLy18w5NdOjoKUhl2/4fhrDez4xxKecp0FZabqfz2depXpcB8q+SAPx8JUP354AZD8ac PZSeRlazV2SyrRQRrrfwrKUzJ6DJqm0jMInCJHc3VOGf6MBNkPbAjaOEEHeRDrL5XWqm GPWA== X-Gm-Message-State: AOAM530+rAw4V9RGO8P6nyD5ARvzzZ+HMnpZMTmRhNQUXItsjYRXoLWz jR34tsD+p0hsVlfqy5dZzEeYnyD6Key1e5F+/8o= X-Google-Smtp-Source: ABdhPJxcnYJM0p7N/K2AejmK15TdlU9fcPjkO+TO+4+0qnmEoPVMOa5Vj+fj2vpvZ0kjntbgoOywMpy7FiHJUbrBU2Q= X-Received: by 2002:a1f:3d46:: with SMTP id k67mr7405990vka.16.1619550460583; Tue, 27 Apr 2021 12:07:40 -0700 (PDT) MIME-Version: 1.0 References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> <179049b1475.11134368b213512.254739612773841999@void.tn> <722ed544-69e3-3be4-f828-185914617228@processus.org> In-Reply-To: Date: Tue, 27 Apr 2021 15:07:28 -0400 Message-ID: To: =?UTF-8?Q?Olle_H=C3=A4rstedt?= Cc: Levi Morrison , David Gebler , Pierre , Guilliam Xavier , Christian Schneider , PHP Internals Content-Type: multipart/alternative; boundary="000000000000e622e105c0f8f916" Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: chasepeeler@gmail.com (Chase Peeler) --000000000000e622e105c0f8f916 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 27, 2021 at 2:57 PM Olle H=C3=A4rstedt wrote: > 2021-04-27 20:17 GMT+02:00, Chase Peeler : > > On Tue, Apr 27, 2021 at 1:56 PM Levi Morrison via internals < > > internals@lists.php.net> wrote: > > > >> I think the conversation on final classes being "bad" has gone on long > >> enough. You don't like final, and you don't want to see more features > >> like it being added, such as sealed. Point taken. Now please stop > >> dominating the discussion, thank you. > >> > >> > > I think the legitimacy of final/sealed classes goes to the heart of thi= s > > RFC. As long as people are going to discuss it and bring up counter > points, > > then I think asking someone to stop defending their view is a bit out o= f > > line. > > > > That being said, David has never said he is against developers being ab= le > > to annotate their classes as being final or sealed. He is just against > the > > engine enforcing such requirements. On this I agree. I understand that > > other languages support this concept - and frankly, I don't care. The > > flexibility that PHP offers has always been one of its greatest strengt= hs > > and this just further erodes that. > > > > > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: https://www.php.net/unsub.php > >> > >> > > > > -- > > Chase Peeler > > chasepeeler@gmail.com > > > > Sometimes it's helpful to apply a risk perspective the shed some light > under hidden assumptions of different arguments. For example, what's > the probability and impact of an event that would limit a coder when a > library is using a sealed class? And the other way around, what's the > probability and impact of an event that would decrease code quality > when a sealed class is *not* used (like being able to subclass > Maybe/Option even when it "shouldn't" be possible)? > > As someone mentioned above, maybe they want to just add some logging capabilities to maybe. class MyMaybe extends Maybe { protected $logger; public function setLogger($logger){ $this->logger =3D $logger; } public function value(){ if(null !=3D=3D $this->logger){ $this->logger->log("getting value"); } return parent::value(); } } > If the probability of such an event is high, but the impact to overall > code quality is low, the risk is also considered low. (Example: Just > create your own Maybe class. Of course harder with more elaborate > classes, you don't want to copy-paste an entire library. And the other > way, extending Maybe is a very local thing to do and doesn't hurt the > library itself.) > > Copy/pasting Maybe into my own MyMaybe class isn't going to be a valid option if I encounter something like function(Maybe $maybe){...} If I can subclass Maybe, then it will work. If MyMaybe is a totally different class, though, it won't. > When both probability and impact are uncertain, it will make it harder > to create consensus, and will make arguments more emotional or > heuristic. When risk is low and the benefit high (and clear), > consensus is easy. > > Olle > --=20 Chase Peeler chasepeeler@gmail.com --000000000000e622e105c0f8f916--