Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49155 invoked from network); 9 Sep 2014 18:27:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2014 18:27:22 -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 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:51374] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/D3-08634-9864F045 for ; Tue, 09 Sep 2014 14:27:22 -0400 Received: by mail-wi0-f170.google.com with SMTP id em10so923906wid.1 for ; Tue, 09 Sep 2014 11:27:19 -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=hPTIbxW5nDl9YayMdZsTSHklIqJjbGLSmIU67F5vkkk=; b=EVAabONRBDl9VNIQvQhAyZKxpAq1eUiZzS/nZQSlfDMdBOe6WBt1osqOOKs+AlylQo UoqgntQGrL0UwFJ1Svm1P0B55AL7zaGVMrkGlEADJbPctcYLh6p4+/HtbvqRZV68yMEL fFkkqzXObRHWOV5yEoPyH7bv8ytgKl/jdVud6U00FSJ7M5RmUy+tHDnlSLadJJIom8er NWt8zlWdBjv0DmSw1JC3QsJ/OXCT0FqSPIDZPehjgFnYC028GZQ8uMuHi0+EwR+WByCB xywuuceQuH0zVtgmuPFkmvxRbL7YtbsDrLleT1vQTd7F6K6l7Bo5oij3bYM9nibWoInY ZNqg== X-Received: by 10.194.173.234 with SMTP id bn10mr44893844wjc.81.1410287239349; Tue, 09 Sep 2014 11:27:19 -0700 (PDT) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id fo19sm16359663wic.1.2014.09.09.11.27.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 11:27:18 -0700 (PDT) Message-ID: <540F4675.9040103@gmail.com> Date: Tue, 09 Sep 2014 19:27:01 +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: <540D638B.8010303@php.net> <24B60FB5-35B8-4B6F-AD6C-54A8B24D4462@ajf.me> <540DC38B.3070700@gmx.de> <06E02C9A-5D22-4AED-865E-1E020722DCED@ajf.me>, In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: rowan.collins@gmail.com (Rowan Collins) On 09/09/2014 18:08, rparker@yamiko.org wrote: > I agree and think we should go with a different operator as others suggested. If not ?? than we could use ?= like $foo ?= “default string”. That reads like an assignment, rather than an expression - particularly given PHP's large number of evaluate-and-assign operators (+=, *=, etc). Actually, that might be a useful addition in its own right. For a full set, we could have the following: // Evaluation as boolean: $bar = (bool)$bar ? $bar : $baz; $bar = $bar ? $bar : $baz; $bar = $bar ?: $baz; $bar ?:= $baz; // Test for null / isset: $bar = isset($bar) ? $bar : $baz; $bar = $bar ?? $baz; $bar ??= $baz; Not the most readable, perhaps, but then "shorthand" and "readable" are often in conflict with one another. Regards, -- Rowan Collins [IMSoP]