Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114154 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26488 invoked from network); 25 Apr 2021 16:55:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2021 16:55:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 39BED1804BD for ; Sun, 25 Apr 2021 09:59:05 -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-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 ; Sun, 25 Apr 2021 09:59:01 -0700 (PDT) Received: by mail-io1-f46.google.com with SMTP id p8so942910iol.11 for ; Sun, 25 Apr 2021 09:59:01 -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=8V+pcHuQaa4zDKwAzIq/wAUjnr9l5TImmliRXftklWc=; b=sklnQzW+3tipFkWQ2crc3bYQW5vo8EUOfNJOk4v96QvEMcjVFfbDVRKIuPzO1fyTH6 tDm0xyPVAUzQfxuQFqyrmShkMSFI/IOB8+lwtdWcRzK12bd2vxow3AZy9g4YiF6wDesp GpxMB4FuYBexIgKKgQeCMhuqdroGzSwcpi5KrXi6wkvPQ0WLV2LWdoZAbVqo2fkcPBey wmQsFdGRxAyf5OGTnQA2UJTHP+OAnFAaBYuKQKHFIpoiSopYgct5HqwsXqrRklw+BD4v xd7J6WuaBuxFFg10chEXoeqVS3c0Sj4lNtxlGESojceJXqPSR6SYr9CQXavKty0Eow56 XA0A== 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=8V+pcHuQaa4zDKwAzIq/wAUjnr9l5TImmliRXftklWc=; b=QzBkCd6lKeEgAgETVtH5K1+okT/jb+mu25e+lWxOkYTvqNe7KZQcoqVPywuVRzHb72 FnOzhnpb2TD2sj6T6AuKOHHbuYBkVcnayJw/iLTU42GGLQaqCi4INMMtmXBdXh1CkQ1i m0xJfocUn8E0mWx5YcUqurZmtKF7W7Nl3RcQtnmfM5Fuos0G5KL5oMgmU7P9we8ycUDJ w2FCIKpXFUjy+HrqhxXc8BYQFcnh2jUgEPJkEysgBx7Q/28jakfGzkdJzzxc8QS1wn99 fRFGmD4pIzSim2rUVXC+ZiEN3jegnw/5l/zRyDZzADntlw2ZQkm/jO4Z8B3P+5OFd/Sm U8Uw== X-Gm-Message-State: AOAM533+2BTGIcPNdoVOHp04Aj4a/2VrJBstJxGSspL3sv0BNLBlw6Wh aC2yGi5GgHjOV0tqn77ZOLNpDR9nAfS/2vmNp/s= X-Google-Smtp-Source: ABdhPJwwncvuSC3medjnabcSsYKU0jQBVc8RVtOiMLBsm4kqIhqbtXZ/YttgiIjiEy5bqpKKRWlTWsZBbJNbT+khg+o= X-Received: by 2002:a05:6638:68b:: with SMTP id i11mr12480427jab.90.1619369939684; Sun, 25 Apr 2021 09:58:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 25 Apr 2021 18:58:48 +0200 Message-ID: To: Saif Eddin Gmati Cc: PHP Internals Content-Type: multipart/alternative; boundary="00000000000003d22905c0cef25e" Subject: Re: [PHP-DEV] Re: [RFC][Draft] Sealed Classes From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000003d22905c0cef25e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Saif sob., 24 kwi 2021, 13:00 u=C5=BCytkownik Saif Eddin Gmati napisa=C5=82: > A major behavior i wanted to discuss is how should sealed interfaces work= , > and specially around `Throwable` which is currently sealed to only `Error= ` > and `Exception`, but allows other interfaces to extend it, and other > classes to implement it as long as they extend `Error` or `Exception` ( o= r > another class that does so ). > > As per the current proposal, if `Throwable` is to be declared `sealed`, > permitting only `Error` and `Exception`, it won't be possible to extend i= t, > resulting in a major BC-break, considering that too many libraries extend > this interface in their own `ExceptionInterface`. > > To work around this, there's two solution: > > 1. don't declare `Throwable` sealed and keep it as a special case. > 2. interfaces declared sealed, can be extended by other interfaces, > however, classes that implement either the sealed interface directly, or > via another interface, have to extend one of the classes the sealed > interface permits. > > The second solution will allow declaring `Throwable` sealed, and would > bring complete consistency between internally sealed symbols, and user > land, without any BC breaks, and IMHO, it doesn't hurt as at the end, no > one will be able to implement `Throwable` without extending the permitted > classes. > I like the idea of sealed class along with proposed keywords which are similar to already existing in other languages like Java. Personally I'd go with the second option. Speaking of Attributes I prefer not to use an Attribute for any particular language feature which expects input arguments to be a valid class or interface name for two reasons: first because there is no effective way to restrict input string to be a valid class or interface name and second that it'd require passing strings which means in most cases passing class or interface name with magic ::class constant read. Cheers, Micha=C5=82 Marcin Brzuchalski --00000000000003d22905c0cef25e--