Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116480 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20548 invoked from network); 22 Nov 2021 20:10:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Nov 2021 20:10:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 809EB1804BD for ; Mon, 22 Nov 2021 13:07: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=-2.1 required=5.0 tests=BAYES_00,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-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.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, 22 Nov 2021 13:07:04 -0800 (PST) Received: by mail-ed1-f42.google.com with SMTP id r25so45760399edq.7 for ; Mon, 22 Nov 2021 13:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DwE5yfphpCt1lBW8r51QB+Er1ZZEG8DLrwpIZyYCeNk=; b=D343MYp/1/tQuYNr/5Nx5BRcRLFLVcs4jpBKNmj+uNreNEq0sbSpNG6b9nPEa+csS+ eB/LCktmIAMgCrVAZG3FTvvq+cH8JeTcFzvDZ3hDN6ZXmPw3wU4kcuiBsOluvLD61D4W EIyP/EQwNXalCuaD0eWgCeU7Sp1lnuYB9Rz8+E+i/J+lB0Tm9ez02hAO7nYX1tuqNinb 4s7ETDWAyjuxMbmw0Ncin3o+lXKdHn95NynhNlNtdg8TpqAk4pweaUXE4fL4BqY40Wpx FcwLPVCu8PGA9dkiToK40pfe+hSEL03KR7tG8Ossslzw5iwUN4G0uCQT7kGEb+KsWo65 lnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DwE5yfphpCt1lBW8r51QB+Er1ZZEG8DLrwpIZyYCeNk=; b=wNfRa3JahZNDi7Oh6DypEoWzBrFi7FYGSBnF9ns4X99t/SPlADAJkFSTg+EkU800LX ebeDMlkOvYx6saYrmEGhEIyaWhiyEcDRdKT+JRRa6foT188Jj/wMda6kP/p3vBcyYi/P y4FuPoRFztKLQIWfwgBdh0honc4rur+tzjp/Mgf4SMEYBcipA8bWoaIuedybUYnH1vMf YTkzYVuD0lSQkjVt9viI7xqRJD7NsmA7Av++s4sqpmPbxd67o0nwSx0AIisDoqGkFmA9 oDzwEFGmqtY2+/7pchr4ZOz/t1k4skZ7Xi2trhRpRMjp3s88bd1FhSrQNbujvynL25yw /XSw== X-Gm-Message-State: AOAM532V2b014p98tdmzF3y0p3IFHwCI9qOEiEkitneu8xdJKPn8VSMo ReYJqmByvRUbkPFnO8KLpmg30rJPGvKvknOlQUQO4xEDzac= X-Google-Smtp-Source: ABdhPJxqhg7NQDvHaieEK8WqQKnX3q1+uy/fQ3N+HE+A4+OsaRSwBxTnKTYea12IqIQram1ncg7ycPWg8VHnhmTU8Pg= X-Received: by 2002:a05:6402:270d:: with SMTP id y13mr50879edd.362.1637615223532; Mon, 22 Nov 2021 13:07:03 -0800 (PST) MIME-Version: 1.0 References: <99cc5fab-42ff-f865-cdfc-8942557c86b8@gmx.de> In-Reply-To: <99cc5fab-42ff-f865-cdfc-8942557c86b8@gmx.de> Date: Mon, 22 Nov 2021 22:06:47 +0100 Message-ID: To: Andreas Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000ad6df805d16701df" Subject: Re: [PHP-DEV] PHP 8.2 proposal: "match", allow "default" as conditional_expression, e.g. 'en_US', 'en_GB', default => loadDefaults() From: nikita.ppv@gmail.com (Nikita Popov) --000000000000ad6df805d16701df Content-Type: text/plain; charset="UTF-8" On Mon, Nov 22, 2021 at 7:18 PM Andreas wrote: > Hi internals, > > This is a proposal to allow to append the `default` pattern by comma to > the end of the last match branch. (Like a conditional_expression) > > This allows to re-use the return_expression if required and avoids code > duplication. > > PROPOSAL: PHP 8.2 > > return match ($locale) { > 'de_DE', 'de_CH', 'de_AT' => loadGermanLanguageSettings(), > 'en_US', 'en_GB', default => loadDefaultLanguageSettings(), > }; > ?> > Isn't this equivalent to just this? loadGermanLanguageSettings(), default => loadDefaultLanguageSettings(), }; 'en_US' and 'en_GB' will already go to the default branch if they're not listed explicitly. Regards, Nikita --000000000000ad6df805d16701df--