Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77305 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56196 invoked from network); 18 Sep 2014 09:26:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2014 09:26:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=ameaijou@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=gwynne@darkrainfall.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.51 as permitted sender) X-PHP-List-Original-Sender: ameaijou@gmail.com X-Host-Fingerprint: 209.85.220.51 mail-pa0-f51.google.com Received: from [209.85.220.51] ([209.85.220.51:63095] helo=mail-pa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/D1-43736-E55AA145 for ; Thu, 18 Sep 2014 05:26:55 -0400 Received: by mail-pa0-f51.google.com with SMTP id eu11so1090259pac.38 for ; Thu, 18 Sep 2014 02:26:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=083tDJPdEBP2xdvii8iHb0F6hCYkpatzit9YRLcS3Rg=; b=dbXRj6lEl+AqjU+9x5WSx9pqYdZ2G1akX5BHCuuR2S87WXwN6BfbMFesgAouKztlZE Ri2nsFVLTJyQBGMOD0Db94R9S7Bf//XvaVq4EtpnOrucNb5OEYfBKw0ozYyf9dj/QtAz KOu6EaKfWBcUz2zBuRrOHJKHIDu4zC477spUQKdlChOXl9a9Qg+puNzKcjMefWbE5N6z cAIjq4tZh1SEwzL7rB8V18tYJmXM7HHGCjPrs36DYtjdiAKNUa9skUde3ldlPF3uoqrJ V+NUAR1lZ7H93cvc+npn6AZ5iCrg/ssdfHh3o2bp6ME+6sjuO92tnHOP+Pfk77HNbLPA IHlQ== X-Received: by 10.70.135.40 with SMTP id pp8mr4315571pdb.116.1411032412409; Thu, 18 Sep 2014 02:26:52 -0700 (PDT) Received: from 136.36.68.68.client.dyn.strong-sf77.as22781.net (136.36.68.68.client.dyn.strong-sf77.as22781.net. [68.68.36.136]) by mx.google.com with ESMTPSA id ve13sm19729504pac.6.2014.09.18.02.26.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 02:26:51 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 18 Sep 2014 04:26:49 -0500 Content-Transfer-Encoding: quoted-printable Message-ID: <54E82419-931D-4F9E-8115-175EA1BDC970@darkrainfall.org> References: To: PHP internals X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: gwynne@darkrainfall.org (Gwynne Raskind) On Sep 17, 2014, at 11:40, Matthew Fonda wrote: > Hi Andrea, >=20 > This is great -- thanks to you and Nikita for the work here. >=20 > Syntax wise, I would prefer a function-like syntax, e.g. coalesce($a, = $b, > 'c') or ifsetor() instead of $a ?? $b ?? 'c'. I find this more = readable, > and it avoids any possible confusion about precedence within the > expressions. Either way, still +1 for this feature. >=20 > Best regards, > --Matthew I=92m STRONGLY +1 in favor of this operator, ASAP; I=92ve had to write = more than a few hacks to keep a large codebase I=92m responsible from = being a complete mess of isset() checks - 5.6 has saved me a lot of what = used to be ugly workarounds (variadic functions anyone?), but this one = still haunts me. I would argue for both coalesce() (as a language token) and ?? and ??=3D, = as shorthand forms, giving the user a choice as to which they find more = readable. ?? is standard in both .NET and Apple=92s Swift language - = Apple added it to Swift (including the chaining behavior) early during = the beta cycle due to user demand for exactly this kind of logic, and = it=92s been part of C# for a long time. -- Gwynne Raskind