Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114123 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95849 invoked from network); 24 Apr 2021 14:39:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Apr 2021 14:39:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DEFA71804CC for ; Sat, 24 Apr 2021 07:43:23 -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,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-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.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 ; Sat, 24 Apr 2021 07:43:23 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id p126so5496155yba.1 for ; Sat, 24 Apr 2021 07:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=MyF2HHmbX7mU/DxF3r2gqxHWQNQxOlwr5gfskE7GDMk=; b=SokHPeIwb0kclNFAY/lqlcyB9cWA3oFByHV7DslssdXWGHcHqgZnq61kolhDmtd/M/ NoonLxjIxaqJ/paC1y8V7HNFagyePtFb1iWTyZPGoD2l1QhgLhl1OGLQiefiiwBfaLyR o+Wan3V2G7JOWvXaWpAMRtYvCTnLFJT7Ykv18= 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:content-transfer-encoding; bh=MyF2HHmbX7mU/DxF3r2gqxHWQNQxOlwr5gfskE7GDMk=; b=Wud0ErMfWR/keHIq/5sDJrG1A38NGg3iw8HqEp13c0cwrsS6n7SA3ogG3XsyRjKrtp SCkB16WzMwjuHi9SGTaLHKk0kqXse5eACUaLJ7ugtuPTLMRUzuWEL1br7FICBY4cEQeV ul85BLTkjSwzplXi1i9ic7ZGYWy49SfZnyXMkGKQ6/lSlEhfxDKxIerkYj/JJgTscA1b e38LY2E7J3u1rTAk6e2ct3PhaLmgquI/UdjCjZEDEi9YpjEAAFfqinAbIAqP0aHQzmUS VQx6md5dFCOuz5rDvDc8vyAD8K+t8Rbyg9KR5vn5E6YtWIpV7Iaf7WM3P1L7GKLy5rF9 dcHw== X-Gm-Message-State: AOAM533a3xzjvSpbC2JEZN65LdgWmfL9EPgczT/GnSfNtUcEUnMpmMfX X2ubzvZm6qjDBOlSGwGArkqjzyoH4T/ahucyC+J5Ow== X-Google-Smtp-Source: ABdhPJw7uG+KuW7alOZNPtg5HLxUJIquYm4KGaMXDWKNPoKzJqugTjb6hBP+ycKzMg9NMFemEGA9PXS1fe8t0zEF0eQ= X-Received: by 2002:a25:5589:: with SMTP id j131mr9886578ybb.402.1619275402568; Sat, 24 Apr 2021 07:43:22 -0700 (PDT) MIME-Version: 1.0 References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> In-Reply-To: Reply-To: Levi Morrison Date: Sat, 24 Apr 2021 08:43:12 -0600 Message-ID: To: Benjamin Eberlei Cc: Pierre , Saif Eddin Gmati , PHP Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: internals@lists.php.net ("Levi Morrison via internals") On Sat, Apr 24, 2021 at 8:04 AM Benjamin Eberlei wrot= e: > > On Sat, Apr 24, 2021 at 2:56 PM Pierre wrote: > > > Le 24/04/2021 =C3=A0 12:55, Saif Eddin Gmati a =C3=A9crit : > > > Hello Internals, > > > > > > I'm sending this email to open discussion about sealed classes, > > > interfaces, and traits feature for PHP 8.1. > > > > > > I have create a Draft RFC here: > > > https://wiki.php.net/rfc/sealed_classes > > > > > > > > > A major concern for few people have been the syntax, in which it > > > introduces 2 new keywords into the languages, therefor, i have added = a > > > section about alternative syntax which could be used to avoid this > > > problem. > > > > > > Regards, > > > > > > Saif. > > > > Hello, > > > > And why not using an attribute, such as in HackLang ? > > > > +1 on this, I said the same on the "never/noreturn" RFC. There is a much > less invasive way to add new keywords/flags to functions by using > attributes. > > Imho this decouples new features from the language and reduces the "risk" > of adding them to the language. That should increase the likeliness of it > getting accepted in my opinion. I think an attribute may be appropriate here because sealed types act like normal types, except we restrict who can extend them. Additionally, we have to provide data about which types can extend the sealed type, so it's not just a simple on/off type behavioral switch (which I think is an antipattern for attributes based on my experience in other languages that have them). This is different from a return type `never`. A function which never returns cannot meaningfully have any return type at all -- using `void` or some other type with an attribute would be a lie. Additionally, there isn't any meta-data to associate with the `never`. I hope this comment doesn't digress into a conversation about `never`; that isn't my point. I'm trying to provide more justification about when I think attributes are appropriate, because I think they may be appropriate here and I think it's useful to show how `never` is different.