Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77621 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58372 invoked from network); 25 Sep 2014 10:31:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2014 10:31:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.180 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.180 mail-we0-f180.google.com Received: from [74.125.82.180] ([74.125.82.180:34303] helo=mail-we0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/02-45824-EFEE3245 for ; Thu, 25 Sep 2014 06:31:26 -0400 Received: by mail-we0-f180.google.com with SMTP id q59so574782wes.25 for ; Thu, 25 Sep 2014 03:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=DvaDOuoVH6hWlLoVA4MSpH7zWRutvozP1TaGyyS2/yE=; b=UaJ719GRqU3H+T+ioqmQPHjLkJ94+EtPUYxO3ghMwnLl+So31OMs3v13jysMwkQOs+ PE+mWghEfhpEIXGdsvKawgqT1tsc/OMnz0BaVmteTx8Y6mW3Oih5TfW1TiNYX4ubfcZ8 rtY0DIJEdwSBJL6ce6fcEBhAeqjM3ZO63Vs75KuNqTnz5HNl5a2Pc58v6gFqH8RBDFBB yuXhDLVLeq+qSzlDiCDZ7skgLDu/E7cqaqLDyAY5W/gLLxhUP5aCaJlrQTI4s0YCSn5i xW4cgOJzKgMU5F3Xb2qsyRW0EN9IAOU40SCKRpzU/EmDynxU+Fq+7p785DtHqyofUJ+X SW2A== X-Received: by 10.180.36.141 with SMTP id q13mr17946371wij.32.1411641083379; Thu, 25 Sep 2014 03:31:23 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id y15sm2674476wib.20.2014.09.25.03.31.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Sep 2014 03:31:22 -0700 (PDT) Message-ID: <5423EEF9.8070000@gmail.com> Date: Thu, 25 Sep 2014 11:31:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "internals@lists.php.net" References: <54233506.8080102@gmail.com> <54233932.8090102@gmail.com> <5423DBF7.8020402@gmail.com> <4ED7146272E04A47B986ED49E771E347BBF5BA23B8@Ikarus.ameusgmbh.intern> In-Reply-To: <4ED7146272E04A47B986ED49E771E347BBF5BA23B8@Ikarus.ameusgmbh.intern> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Little switch improvement: get the used variable From: rowan.collins@gmail.com (Rowan Collins) Christian Stoller wrote (on 25/09/2014): >> Am I missing something equally obvious there? Or just, it doesn't >> >interest people much as an idea? > Why should one add a new operator in that context if it is already > possible with assigments as expressions? > > This makes the language more complex without getting any improvement. Sorry, I was talking about this bit: > Currently, switch always uses a "loose" comparison (==), so cannot > distinguish between "case 3" and "case 3.0". Occasionally, it would be > nice to switch on a strict comparison (===); but then I thought, why > stop there? What if you could use switch with any comparison operator? > > My idea is to give the switch() statement an optional "use" clause > (since that's an existing keyword) containing a single comparison operator See my earlier e-mail for examples and further details. Maybe I should have given it its own thread so it was more visible; the idea has been brewing for a while, I just thought this thread was a convenient place to mention. -- Rowan Collins [IMSoP]