Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77285 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83285 invoked from network); 17 Sep 2014 13:42:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2014 13:42:23 -0000 Authentication-Results: pb1.pair.com header.from=robin@kingsquare.nl; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=robin@kingsquare.nl; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain kingsquare.nl designates 141.138.142.202 as permitted sender) X-PHP-List-Original-Sender: robin@kingsquare.nl X-Host-Fingerprint: 141.138.142.202 spring.kingsquare.nl Linux 2.6 Received: from [141.138.142.202] ([141.138.142.202:55143] helo=spring.kingsquare.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/83-57031-DBF89145 for ; Wed, 17 Sep 2014 09:42:22 -0400 X-No-Relay: not in my network Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by spring.kingsquare.nl (Postfix) with ESMTPSA id DE6D5E9CA25 for ; Wed, 17 Sep 2014 15:42:17 +0200 (CEST) Received: by mail-lb0-f175.google.com with SMTP id n15so1828703lbi.20 for ; Wed, 17 Sep 2014 06:42:17 -0700 (PDT) X-Received: by 10.112.236.105 with SMTP id ut9mr41404067lbc.17.1410961337633; Wed, 17 Sep 2014 06:42:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.134.67 with HTTP; Wed, 17 Sep 2014 06:41:57 -0700 (PDT) In-Reply-To: <15567763-3134-43D5-8567-24841C6E831C@golemon.com> References: <540D638B.8010303@php.net> <24B60FB5-35B8-4B6F-AD6C-54A8B24D4462@ajf.me> <540DC38B.3070700@gmx.de> <324F7C72-BC72-4109-941E-BA2947EFA4E7@ajf.me> <0D0523A9-088B-4923-BA21-22F560E18013@ajf.me> <541896CF.50000@gmx.de> <15567763-3134-43D5-8567-24841C6E831C@golemon.com> Date: Wed, 17 Sep 2014 15:41:57 +0200 Message-ID: To: Sara Golemon Cc: Christoph Becker , Andrea Faulds , Adam Harvey , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: robin@kingsquare.nl ("Kingsquare.nl - Robin Speekenbrink") 2014-09-17 10:58 GMT+02:00 Sara Golemon : > >> On Sep 16, 2014, at 13:46, "Kingsquare.nl - Robin Speekenbrink" wrote: >> >> As a userland point of view on this: will this have a shorthand? i.e. >> what will happen if i leave out the second part? >> >> ie. >> $var = $_GET['test'] ?? ; >> >> would that be the same as >> $var = @$_GET['test']; >> >> The RFC isnt clear in this regard (or that the righthand side of the >> operator _is_ required... maybe it's me ? >> > The equivalent of your error suppressed example would be: > $var = $_GET['test'] ?? null; > > I don't think it gains anyone much to have another form just to save four characters (for the default `null`). > > Someone mentioned an assignment version which isn't covered in niki's patch but would be a fairly trivial addition. > > $var ??= expr; > > Which essentially means: > if (!isset($var)) { > $var = expr; > } > > I'd kinda like that for completeness, but will vote for this with or without the assignment version. > > -Sara Sara, Indeed that's what i meant. I'm afraid that i just wasn't clear the first time. But would indeed also like to see the ??= in one go. This would make the operator a direct first-class citizen of the language instead of halfway there ;) Thanks again, i'll butt out now ;) Robin