Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102252 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63073 invoked from network); 14 Jun 2018 05:26:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2018 05:26:33 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 74.125.82.66 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 74.125.82.66 mail-wm0-f66.google.com Received: from [74.125.82.66] ([74.125.82.66:51414] helo=mail-wm0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/67-29356-78CF12B5 for ; Thu, 14 Jun 2018 01:26:31 -0400 Received: by mail-wm0-f66.google.com with SMTP id r15-v6so8281988wmc.1 for ; Wed, 13 Jun 2018 22:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FwsP7MgSHN9Mn1hHX8BOnhc2uT4BCr6z1NMPaWVORjo=; b=AFNlKKK7yu7D0IjC9Ljlaoy/JHtrf/jGP23WdRfuK0IpBdpJECRhRW8oOU48Q5jqSh JcWsctCUhaOQMKtibMb8ogaaahRUbAgAxGRILvVFA69e8RxDAcUfCsUg+RCMjASoVA0T WCTIQp4RW8F8nocuXZHGQPIfp476Yu75+w8rk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FwsP7MgSHN9Mn1hHX8BOnhc2uT4BCr6z1NMPaWVORjo=; b=hZ/7o2zbwTXFPWxliDWyQ5wxZ4AMhgDHUdQnbj4+baEkEuGBjaDFih2pOzP2JSSshV nMYP3HN1WZlO5TSpj+KSnizdUqtUrfVlMYYF2Hf8AVTzQFdNlfiSlNbzdbLWx0Kqq+8Q cazVSblcbPLN6qnRQOResfge+i5k6PicdIAQhsN69r52JE6Wjk77aHG7SeDfOoCDD4we j3XD/50NJKOjBlNCsVtXdW4V/rrNU5oDbCOpRzwmdoJy5RWRdv+XSBOgnEL2ASZacrf9 CN4UL2q6erLT/A7Eda41ERjiYMalVqirci5sObkLuYLIxtDmCnx7G7EPE2evvEWpvi+2 tD2Q== X-Gm-Message-State: APt69E2DRdaaV3GbwqkOONLsEEC+gYM0zudCVFR+sOgyChhsFZUZab6G om7Bon4Nmf/lUJRwHWLwS2f1+g8CL3XL/b0l18f6gVvs X-Google-Smtp-Source: ADUXVKK+lq4am7z16FbOzumDEUIHoUmkiDvEOKw8YnMBFf6iDw16jl9p3NOvi2pJA1ifYveAFCrEU27REpg896L2ZQA= X-Received: by 2002:a1c:ac02:: with SMTP id v2-v6mr630587wme.79.1528953988315; Wed, 13 Jun 2018 22:26:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:a978:0:0:0:0:0 with HTTP; Wed, 13 Jun 2018 22:26:27 -0700 (PDT) In-Reply-To: References: Date: Thu, 14 Jun 2018 08:26:27 +0300 Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Strict switch statements From: narf@devilix.net (Andrey Andreev) Hi, On Thu, Jun 14, 2018 at 7:53 AM, Sara Golemon wrote: > Just for casual discussion at this point: > https://github.com/php/php-src/pull/3297 > > switch ($a) { > case FOO: > // Works exactly as current behavior. > break; > case == FOO: > // Nearly identical, though not using the ZEND_CASE optimization. > // Can probably make this equivalent to `case FOO`, but it felt > like an interesting direction. > break; > case === FOO: > // Only triggers if `$a === FOO`, no type juggling > break; > } > > Love it? Hate it? See obvious flaws? The implementation is just a > rushed proof of concept, not something I've labored over, it may well > have bugs. Certainly wouldn't target anything earlier than 7.4, if at > all. > I love it for the === part. Countless times I've had to avoid switch statements because they can't do strict comparisons. Cheers, Andrey.