Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112501 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46077 invoked from network); 14 Dec 2020 21:12:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Dec 2020 21:12:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 14A581804C9 for ; Mon, 14 Dec 2020 12:43:09 -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-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (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 12:43:08 -0800 (PST) Received: by mail-io1-f49.google.com with SMTP id n4so18245635iow.12 for ; Mon, 14 Dec 2020 12:43:08 -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=ORxJgEtj6kO4Dr4PYkd1ldvbltRbZEvp3YSKT7Earh4=; b=kz3Q0JzE8FkXmaPKmhzmiBBioV2SDuNHm56tTnHfk4yQ5wt2nWQ3Kz32VDa+0ta+ST GaskiUXwCWl1JhMWXJfKC3BVT6D8JDedNWbzmCgmVj4d5mQBnqb9moOGCTdT6taKurJQ h8++Ny4JGBTGqYMBuUXTWYBS1cxotBA1DybUSmwAy6/IV5yHeIsm3fs42AQwkevQupyS 4DyCO33ycA44xUmEbocakXcC8QxFc1gcajNPwjYRcLgz6xsTdlsWSueZI19XjhGPeIYC HTttH69Uf5qTmM2gga/ERXIiQy5ZP/JrM6v5rrHVw3UUdrYHPWtnB6FAxwFeGOlZastj QRKw== 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=ORxJgEtj6kO4Dr4PYkd1ldvbltRbZEvp3YSKT7Earh4=; b=tCx2GMJp/3p2t/Q1awtiyNmZc17mES/DU+HMCZPBoKH0aQLt8s3I5n6XD8j1fQR2KB M9MdxKON1Gn3Wx+v/QofVLMduQiWnbk2JIH+QUAa8laildbOdRhxXe+kCMeTCw44baMw w/TGWWruGpk1rGOW3HByZkBkXRHJpz6yfwWKlo8Dk798t5NQKFtJ0AGE5JX7xaE+t/G1 TjXrijibaRvwGLJoGGlD52DR2ahEyEGGfuPVwbc92aoZDbCg3/H2pjDB0kXo/vTXt7Q7 3WYE8ONUkkyhvJT4MpO6CVISKdclJAkAYwiGUtn4oxdAvS2lPV36dm1rpbRVkpKwrdiG apfg== X-Gm-Message-State: AOAM531JWn82JG+Hg7fuHQf09rfQ9lq5OS8whslgh0Hhxw4HS3v2wxAq VmfI2kosseXNSxrhw12OUXDWTN7L0n+dVGkKGgE= X-Google-Smtp-Source: ABdhPJx/VjRjEr6W+/ic5sDICNAMnhWJAYmzId0SULQTC258oPEdiJYQDEHGdPOSeOmg6AnBA6MClf/jk94q9X6gVJs= X-Received: by 2002:a02:b153:: with SMTP id s19mr34659468jah.122.1607978584677; Mon, 14 Dec 2020 12:43:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 14 Dec 2020 21:42:52 +0100 Message-ID: To: Doug Nelson Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000589eec05b672b0ca" Subject: Re: [PHP-DEV] [RFC] Short-match From: ocramius@gmail.com (Marco Pivetta) --000000000000589eec05b672b0ca Content-Type: text/plain; charset="UTF-8" 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. --000000000000589eec05b672b0ca--