Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112504 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55471 invoked from network); 14 Dec 2020 22:28:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Dec 2020 22:28:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 544501804F2 for ; Mon, 14 Dec 2020 13:59:32 -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.1 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.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 13:59:31 -0800 (PST) Received: by mail-ej1-f49.google.com with SMTP id w1so20076731ejf.11 for ; Mon, 14 Dec 2020 13:59:31 -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=SCwc85oDU4rxpf+T78DoJJ+VkoF6Uhs9pbSeybXSN3o=; b=pjc/1Yq1e8l3MLk4FoL+X/HIurZOEMIUyxhudv8y42b3SbF8WaXXlbVCyArltcRDcD LqtFhSIUgUauac556ScsKpod/ge8AD9LmRzegugKVkTzJaOUcrNt44Bva6U/PVEh4Mdj jOqrcUpu3T3V911QOLfxvoOpNr/a5YPQhYiaixFheiOVC57kHmX3XGSV0LpYzL++J4v4 pCN2UhrVyuvyRiy7q3CvuFzGik/j9KMutabafUKbKQl/uwnGAVcoPBuYUfES4beclXaG 4VUVBGioysub96b2nOR/XlUogPc8OOAoFT4n+cy8rKVi9Xfkv6hA6Fr4KQ1FM0fuOpUn I5/g== 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=SCwc85oDU4rxpf+T78DoJJ+VkoF6Uhs9pbSeybXSN3o=; b=RQN3l3GVxbe13Vpnqyqq1VOy8CeLtItwY6AITLtBbhIs4eINhB+BQV2vfcEsQtzSem OO6rDF7pxWQpoKeovGVGhwkcvzxFPnS4RbQ/308l17Z07fA1LCcd91edHjRD8zOT0Pdm lSLO5feHcQNXlH+tLQDlQ3UgifTCGadewI9AFYxbvxxqpUEaSNfHbMqn+o1KmZP84u2C ktZ2C+3rqYqgBHRcskIHYkZ6kUNGf5s8TMolVtrPU6C9dnp5rOENi8He6TKFSTa1kQ7B j+l68BrmKAyR/Vw3+xlQXeZ0o+JFQJh68qqGtSceIFh20PBDs8qSzcmB8ABbpsQVgRYG A8kw== X-Gm-Message-State: AOAM533RwTCFLSCv/u1W4EGGMZ+eaPKGNYPrnjQOu4fPpsq0/9X7wWD8 wczB5zSkCFsJIIc3O8zjhHbpr9/cpQtAfoT7NHQ= X-Google-Smtp-Source: ABdhPJwqmBc4R20HePIAw399RLlowSo9QIRHh9QjlOCGVwVN7ugZj5sdEEa10RmRCX77+n807kTN/twj7C8x8bu80ZE= X-Received: by 2002:a17:906:5f92:: with SMTP id a18mr2842804eju.126.1607983168916; Mon, 14 Dec 2020 13:59:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 14 Dec 2020 21:59:18 +0000 Message-ID: To: Sara Golemon Cc: Doug Nelson , Marco Pivetta , Larry Garfield , php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Short-match From: tekiela246@gmail.com (Kamil Tekiela) I don't understand what's the advantage of the short match? Why would I ever want to use it? If I ever saw this kind of code in my codebase then I would immediately refactor it to use if statements. That is just abuse of match statement in my opinion. If someone wants to abuse match syntax like this then I think they should put (true) after it to make it clear what they are doing. Allowing match without the match subject will be lead to confusing problems for a lot of beginners who will forget the match subject or mis-copy it and then wonder why their application does not behave as it should. IMHO I see no benefit of adding this feature to PHP, and I actually see disadvantages. On Mon, 14 Dec 2020 at 21:23, Sara Golemon wrote: > > On Mon, Dec 14, 2020 at 2:24 PM Doug Nelson wrote: > > > 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. > > > > > I'm not a full -1 on the concept (especially as match(true) has the > convenience of returning a value), but it's very square peg in a round hole > to me. > > At the end of the day though, that's a style choice and not one I have any > business imposing on anyone, and certainly within the context of this diff, > the actual change is trivial. It's sugar for match(true) that looks like > match. /shrug > > I might suggest broadening the scope to include `switch` as well though. > If we're going to codify match(true) as a pattern, we should at least be > consistent about it. > > -Sara