Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112426 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95886 invoked from network); 5 Dec 2020 15:37:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Dec 2020 15:37:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0F6851804D1 for ; Sat, 5 Dec 2020 07:05:57 -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=1.2 required=5.0 tests=BAYES_50,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from processus.org (ns366368.ip-94-23-14.eu [94.23.14.201]) (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, 5 Dec 2020 07:05:55 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by processus.org (Postfix) with ESMTPA id 926275101324; Sat, 5 Dec 2020 15:05:54 +0000 (UTC) To: Larry Garfield , php internals References: <3c47b09a-5678-5a27-f482-114d0469cf4d@processus.org> Message-ID: <0e921d03-28ad-de72-7b5d-2c37280b8ea5@processus.org> Date: Sat, 5 Dec 2020 16:05:53 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: processus.org; auth=pass smtp.auth=pierre-php@processus.org smtp.mailfrom=pierre-php@processus.org X-Spamd-Bar: / Subject: Re: [PHP-DEV] [RFC] Enumerations From: pierre-php@processus.org ("Pierre R.") Le 05/12/2020 à 15:42, Larry Garfield a écrit : > On Sat, Dec 5, 2020, at 3:26 AM, Pierre R. wrote: >> Another question, about match() behavior: >> >> > This usage requires no modification of |match|. It is a natural >> implication of the current functionality. >> >> May be this could be the time to have a "strict match", using enums, we >> can "statically" guess if branches are missing (of course, whenever you >> use default it valid to miss branches) - one thing I'd love is PHP to >> throw a fatal error when compiling a match expression whose missing >> branches, and not wait until runtime to fail. > I think that would make a great follow-up, but it's out of scope for now. Having match statically know what the available types are when the variable type isn't yet known (because it's in another file) is... I don't know how to do that. That's a broad problem across PHP, frankly. If we can figure out a way to do so, I'd support adding it in the future. (I can't speak for Ilija, but I suspect he would be on board as well.) > > --Larry Garfield Yes, I guess that's a broad problem that could only be fixed with package handling at the language level, and autoloading done by the compiler and not userland (simply put, that can only be fixed by killing autoloading once for all). But that's a much more complex and bikeshedding topic. Let's consider that your RFC is good as it is (and it is honestly, I love it). Regards, Pierre