Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107553 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70983 invoked from network); 16 Oct 2019 05:49:12 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 16 Oct 2019 05:49:12 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 397AB2D2020 for ; Tue, 15 Oct 2019 20:33:30 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Tue, 15 Oct 2019 20:33:29 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id z6so18912707otb.2 for ; Tue, 15 Oct 2019 20:33:29 -0700 (PDT) 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=gYyG0eitTzMiBy/3BisDi5Aol8P+FPQOqfVozLenP6g=; b=iZfOLPtiauwaIyZLm3OgHdTkEKKayPA0fDpT2T4IvxHxsP/06PymN0onj03w1VKZvW ftbgi7aQDfGaOCNAtQw588p1J+jH5sTk7zlQaGw4uqXj9PHWmM7Lspup7EZUCwG970Bl tmP0VJYHmeinkK31HgxFi+k3BAjWzSIJkOjofm0dBfguriRtNicPPb0zNRaFDzQe/6TP nUa0ucQ5k8XCcY7HCJyDzhuAhvDrg8GtrVOaOJK3yAYhgqAsCf/5b0Z/MJgdFeHA4hKs 63jYWa4im15S38Tn4zKjL+y9PqHs8hnrnHAI+x7+evls3Ht4xAfs6bg24Qvc+hQuIlSV 3grg== 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=gYyG0eitTzMiBy/3BisDi5Aol8P+FPQOqfVozLenP6g=; b=i0Cx1tVGo5rUjJXr1+lkjQZ6FvQMWMfu3Z4aVGwA0SbgGoN3ks9O1Dhxpu1v/u/0BA pvyh1EToD/1noO6hxyF8fiA9phhpzyQCMRbGB7GQgH57EX5SFBsTbIQ2AeXktpdyavnn 6mUoaAakiqzPu8CZTHWfrs6bG6YhJzD2h/A0jVAho2QMO6qyNbGNUo7fJOVyI1AdsN8U iZUGCPLaGuy9iW+xVArDEdAkil2d2yHr2Ame6Pvwe7B8pyRUBpDxVwLaXQXJ7eOiorme hm8CWtS62BJ2eaCJQzhGFcj++LUCOJUomCwHuXoe7jfpYb/bsWv/LxJFSdiDcdcQWyId 7ZOA== X-Gm-Message-State: APjAAAXCEmkUco09b3SVJBzh1i7OxEGjy7YEnkOP9dfH74BMBVSlHOsf KKJzaSERD8Xmg/+06BzXPtMi2XxtEbQGcFv1hN0= X-Google-Smtp-Source: APXvYqwc4xMwmkvBgkymsUe1ZJXFw4OOHI5T4VdZv9DzFdZjSEtY8uZuxszjvzZCZk3V1YS7XpfkNx3lK0oogCk7RLw= X-Received: by 2002:a05:6830:17db:: with SMTP id p27mr32645466ota.258.1571196808926; Tue, 15 Oct 2019 20:33:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 16 Oct 2019 05:33:16 +0200 Message-ID: To: David Rodrigues Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000ab1a1b0594fec389" X-Envelope-From: Subject: Re: [PHP-DEV] Inline switch as alternative to nested inline conditional From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --000000000000ab1a1b0594fec389 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi David, I'm interested in this feature this is called switch expression and is on my list of RFC to process after Object Initializer RFC. I have an RFC in draft for that and planning to finish it soon together with some syntax optimisations - you can see it at https://wiki.php.net/rfc/switch-expression-and-statement-improvement Cheers, Micha=C5=82 Brzuchalski =C5=9Br., 16 pa=C5=BA 2019, 03:46 u=C5=BCytkownik David Rodrigues napisa=C5=82: > Hello. I like to suggests a discussion about a FR to make possible to > inline switch, as an alternative to nested inline conditionals. > > $value =3D switch (expr()) { > case A1: return A2; > case B1: return B2; > default: return C; > } > > Instead of: > > $expr =3D expr(); > $value =3D $expr =3D=3D A1 ? A2 : ( $expr =3D=3D B1 ? B2 : C ); > > Just a discussion to check what do you think. > > -- > David Rodrigues > --000000000000ab1a1b0594fec389--