Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114182 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14584 invoked from network); 26 Apr 2021 07:50:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Apr 2021 07:50:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C09A1804DC for ; Mon, 26 Apr 2021 00:54:12 -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=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (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 ; Mon, 26 Apr 2021 00:54:11 -0700 (PDT) Received: from wafer.home (unknown [IPv6:2a02:1205:502d:fa80:504d:ad16:a1a8:f3db]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 50944150ED04 for ; Mon, 26 Apr 2021 09:54:05 +0200 (CEST) Content-Type: multipart/alternative; boundary="Apple-Mail=_FC0CF2BC-3FD0-4019-9FD8-758A88309B1B" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Mon, 26 Apr 2021 09:54:04 +0200 References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> <179049b1475.11134368b213512.254739612773841999@void.tn> To: PHP Internals In-Reply-To: Message-ID: X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: cschneid@cschneid.com (Christian Schneider) --Apple-Mail=_FC0CF2BC-3FD0-4019-9FD8-758A88309B1B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Am 25.04.2021 um 05:47 schrieb Larry Garfield : > In practice, I think all of the use cases for sealed classes are = ADT-esque. As I noted before, combining sealed classes with Nikita's = new-in-expressions RFC would allow for this (also using my = short-functions RFC for this example, although that's a nice-to-have): >=20 > sealed class Maybe permits Some, None { ... > } >=20 > final class None extends Maybe {} This is exactly the thing I'm worried about. Say I want to add something like logging to the None type. Now your sealed and final classes prevent me from defining MyNone = extending None even though it would be 100% compatible with None. Just = because *you* deemed that useless or wrong. I've encountered situations like this and came to the conclusion that = while this makes sense for languages like Haskell - where the whole idea = is to be able to reason about a complex type system - it is an = anti-pattern for other languages like PHP. Referring to another post, not yours: People, please don't use Java as a = reason to add something to PHP, Java is the king of anti-patterns ;-) - Chris --Apple-Mail=_FC0CF2BC-3FD0-4019-9FD8-758A88309B1B--