Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112502 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49506 invoked from network); 14 Dec 2020 21:45:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Dec 2020 21:45:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED2E31804F3 for ; Mon, 14 Dec 2020 13:16:05 -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_20,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-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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, 14 Dec 2020 13:16:05 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id x20so14307940lfe.12 for ; Mon, 14 Dec 2020 13:16:05 -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=gOzleosbEImcX2+SzGNowFb2DWGH8DMsVYDmnID1E7A=; b=LryDJNxph4WkKA5ogWj1s0hKMcc7ObT+nxp+jmdGa022NjPlUOAq5ZcHmgxF1uvLxW DcSbGdYW9Lbdbi32R88IY+vqpPylOU37rPdzRVhD5c4bKBqiOShm//hBVgvflhfX2s+4 nFtxulnEzLVVthSR5F6L9K5P6pq327QUGr/1GScnmHyHrg3dOjsv2gtAyXH5/hFwrsN6 Ek9uR2TItC9eG/x1o0UCZ0hgSsYD50ACpDrvGSz75gVgnl1bqnrx/wzeHQaGI0eDW/Q/ c7wCSQol7LO7/hMdlF83WTX11GpuHnZweaKSR8K5TNV/Yw4p/a9V1c444ym3f3XqOwGY ugXQ== 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=gOzleosbEImcX2+SzGNowFb2DWGH8DMsVYDmnID1E7A=; b=Mt+snk8Q4qYeB+SaHqqUHnQdcszAAu8G0Erp0wqmAOa47uj5YxH6wXbCrBRGdnbrzj vx4jxrI5RL2hl0Q5Uga0tC7et60sZSaykxcPB3Y6cvBnQqN9zO9GebPWTAL2+5cFiK4+ IsgX9tXg62/EkbSziXAPCS3vSpfb28uvPt+wrtyuxKWUqd8OVhwImaBJDZTW6lhmSCF8 ViCMRB3JmTwZlXOfapEQYt5g1bBX5dAN2bt6uIK7VCUn3aKSDe4qwF6Z6knyWfIR5T6L EYg+qc73wffdj+F6PRDpcjBiiTsBiM74n2TwBvUz3wZUQkNEUyw2J+RzBe2BdlPfa/Bt dCwA== X-Gm-Message-State: AOAM532A/KnM2Q+ZPSpvCLOynuxWHNMB0PiBLWuyjPWCqaWFQfJIe08T /kJNYc4D+s+6CRbbGnY1tStGGXcgmPwXGmkuWq8= X-Google-Smtp-Source: ABdhPJz5PJACb31cPwYe/3bEr84t0LjXp2jNmP/SoNnx8ERWeNZj/HhkXOB8VRY9IEAmvC0EgWXzy3IQ23pe6s+Uxic= X-Received: by 2002:a05:6512:34d3:: with SMTP id w19mr10040508lfr.418.1607980564300; Mon, 14 Dec 2020 13:16:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 14 Dec 2020 22:15:51 +0100 Message-ID: To: Marco Pivetta Cc: Doug Nelson , Larry Garfield , php internals Content-Type: multipart/alternative; boundary="00000000000057480d05b67326db" Subject: Re: [PHP-DEV] [RFC] Short-match From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) --00000000000057480d05b67326db Content-Type: text/plain; charset="UTF-8" Another situation in which _ might be useful. match (_) { ... } On Mon, 14 Dec 2020, 21:43 Marco Pivetta, wrote: > Hey Doug, > > > > > On Mon, Dec 14, 2020, 21:24 Doug Nelson wrote: > > > Hi Marco, > > > > Is there any chance you can elaborate on why you feel it's a bad idea? > > > > Both you and Sara at different points have talked about thinking was bad > > practice, but I've not read anything compelling about why it should be > > considered as such. > > > > Kind regards, > > Doug Nelson > > > > On Mon, 14 Dec 2020 at 18:14, Marco Pivetta wrote: > > > >> Hey Larry, > >> > >> On Mon, Dec 14, 2020 at 6:34 PM Larry Garfield > >> wrote: > >> > >> > I present to Internals this tiny RFC to follow up on the match() > >> > expression RFC from earlier in the year. There was solidly positive > >> > support for this shortcut previously but it was removed for simplicity > >> at > >> > the time, with the intent to bring it back later. It's now later. > >> > > >> > https://wiki.php.net/rfc/short-match > >> > > >> > >> Overall back to the `switch (true)` case, which IMO is not a good idea > in > >> first place :| > >> > >> Nothing wrong with using a set of conditional that are put in a sequence > >> through `if ()`, for these rare cases. > >> > >> Marco Pivetta > >> > >> http://twitter.com/Ocramius > >> > >> http://ocramius.github.com/ > >> > > > > > > -- > > Doug Nelson > > Senior Software Engineer > > > > > It's effectively yet another way to write something that already exists, > which means more syntax to learn, more syntax to deal with (in downstream > tooling), and that for an edge case being a fall-through list of boolean > expressions, which is what already happens by using `if` with early return > statements. > > Let me rephrase it then: > > * It brings little to no advantage to the table for something seen very > rarely (`match` already being super-rare, since adoption didn't even start > yet) > * It increases language complexity > > Every time new AST is to be added, that complexity needs to be weighed > against the benefits, and I don't see any compelling ones here. > --00000000000057480d05b67326db--