Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112464 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91605 invoked from network); 7 Dec 2020 21:14:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Dec 2020 21:14:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A55EA18050A for ; Mon, 7 Dec 2020 12:43:47 -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=-0.2 required=5.0 tests=BAYES_40,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-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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, 7 Dec 2020 12:43:46 -0800 (PST) Received: by mail-lj1-f180.google.com with SMTP id x23so9518415lji.7 for ; Mon, 07 Dec 2020 12:43:46 -0800 (PST) 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=XFdZB5cBYDWF/GxqzSk413Hr1hY+OagszBmLtwVR4ok=; b=uAlBbB0d82yAqMzM5tpwPB/ylbI4XZJcLlmVXz1e0jLBCy+VIpiy884aYCkaCdjYSD +39s7sVGc3AeGoiGmN490NKX+xd7rPHpaLHfyMVPqlmWQLRf/qb9TFzRctRHMyKoHFVR H5TR+TgITlDAizGckNDvqtQ7arviCoa4CpK1K2kuSq/+ZQc5FcbNrY8TPLW2k2LX2C5Z 14OfeSsMgG73BNcQBhBnxA/E1IPPtIMAQ3ZXBOHHxQEjBDQqDf0L+cAIPUUuxy7cbdZO TbPIKzpm2t3bL2LQMRQg2oP+XEdiQTgipwaSiKKHJhgeTZOclRhZ4MB3plWniEsFdfQO lfrw== 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=XFdZB5cBYDWF/GxqzSk413Hr1hY+OagszBmLtwVR4ok=; b=I1ff1A87p/JD0TUCgPcwbPiHesT4dVAWCDuutNvyZ0rtp+5GkDcNJlH+S2Rdby2ysN 4Z9kJlFWOhduuAd4ToeYtBKyorouslMZWHLP2tnbAjlvgP3YPTIo7ar1VrJyLD1vjhW9 PJw3exy5qqZOz5wCRkb/4tMvMXwyfmcRBeVau9ww7RZ8YmHxzrMzF1OlqOFeIGwtWIBs KtueOPvjJAZWwiF3kLrZTy87fMjRM7me9cHDz8H2dI3Fuc7MCf/zSi9JRwN0JnWPAZyj wKZIcnvD46+dArvDlLXSR7q+ZZlOi/aMegOi1Ixclho2Y/c543+/LZWuHoUfp4dIZfwZ Jjrw== X-Gm-Message-State: AOAM533yEvEoEQdjJsDRvM9lst4/yl92Xi5kuxRrKgiSwEUupgYOBN4b 7fR3hbz7/+9lF6jAqG78p1hTKM0DRdImi0Ep1UQ= X-Google-Smtp-Source: ABdhPJwCx5oFc6FkKkN1O/uU/VfQWkNvuowW97qBeezx31hBuJQ8kARhdS6ni1mNOX2hNCHOYUpmVl/qE9baYndECeU= X-Received: by 2002:a05:651c:321:: with SMTP id b1mr9375276ljp.387.1607373825336; Mon, 07 Dec 2020 12:43:45 -0800 (PST) MIME-Version: 1.0 References: <3c47b09a-5678-5a27-f482-114d0469cf4d@processus.org> In-Reply-To: Date: Mon, 7 Dec 2020 21:43:31 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000e16aa805b5e5e10d" Subject: Re: [PHP-DEV] [RFC] Enumerations From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) --000000000000e16aa805b5e5e10d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 5 Dec 2020, 15:43 Larry Garfield, wrote: > On Sat, Dec 5, 2020, at 3:26 AM, Pierre R. wrote: > > Le 05/12/2020 =C3=A0 00:24, Larry Garfield a =C3=A9crit : > > > Greetings, denizens of Internals! > > > > > > Ilija Tovilo and I have been working for the last few months on addin= g > support for enumerations and algebraic data types to PHP. This is a > not-small task, so we've broken it up into several stages. The first > stage, unit enumerations, are just about ready for public review and > discussion. > > > > > > The overarching plan (for context, NOT the thing to comment on right > now) is here: https://wiki.php.net/rfc/adts > > > > > > The first step, for unit enumerations, is here: > > > > > > https://wiki.php.net/rfc/enumerations > > > > > > There's still a few bits we're sorting out and the implementation is > mostly done, but not 100% complete. Still, it's far enough along to star= t > a discussion on and get broader feedback on the outstanding nits. > > > > > > I should note that while the design has been collaborative, credit fo= r > the implementation goes entirely to Ilija. Blame for any typos in the RF= C > itself go entirely to me. > > > > > > *dons flame-retardant suit* > > > > > 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 variab= le > type isn't yet known (because it's in another file) is... I don't know ho= w > to do that. That's a broad problem across PHP, frankly. If we can figur= e > 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.) > Static analysis can (should?) be taken care of by any of the tools available for PHP. Wouldn't it be a waste of effort to try to include it in the runtime parser as well? > --000000000000e16aa805b5e5e10d--