Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23142 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19359 invoked by uid 1010); 4 May 2006 01:33:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19344 invoked from network); 4 May 2006 01:33:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 May 2006 01:33:25 -0000 X-PHP-List-Original-Sender: dante@vocalspace.com X-Host-Fingerprint: 69.56.193.72 fox02.stravio.com Linux 2.5 (sometimes 2.4) (4) Received: from ([69.56.193.72:49697] helo=fox02.stravio.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 93/0F-63443-4E959544 for ; Wed, 03 May 2006 21:33:24 -0400 Received: from [127.0.0.1] (unknown [66.243.31.162]) by fox02.stravio.com (Postfix) with ESMTP id 661DA26C2F2; Wed, 3 May 2006 20:33:21 -0500 (CDT) Message-ID: <445959DD.9030607@vocalspace.com> Date: Wed, 03 May 2006 20:33:17 -0500 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Rasmus Lerdorf Cc: Jochem Maas , Rick Widmer , PHPdev References: <44584619.60400@lorenso.com> <200605030815.34801.johannes@php.net> <44585828.1030603@vocalspace.com> <44585E89.6000400@vocalspace.com> <44586BDF.6040600@developersdesk.com> <4459410D.9090802@vocalspace.com> <445942E9.201@developersdesk.com> <44594553.6020009@iamjochem.com> <44594A27.4040201@vocalspace.com> <4459558D.7050703@lerdorf.com> In-Reply-To: <4459558D.7050703@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Seeking 'coalesce' php internal function From: dante@vocalspace.com ("D. Dante Lorenso") Rasmus Lerdorf wrote: > Not sure what you guys are talking about. ?: is on the roadmap. > -Rasmus Ok. That has some signs of hope. What is ?: exactly, though. I searched '?:' and yeah, good luck with that in documentation. It doesn't smell like it supports all the specifics that 'filled()' does. Am I supposed to do this: $value = $x ?: $y ?: $z ?: $default; And no warnings will be thrown for $x, $y, and $z not existing? Did you see my post about 'filled()'? http://news.php.net/php.internals/23132 Honestly, I'm happy to see '?:' because that's better than nothing, but I think filled() is more like empty() and would be a better implementation. If you want to look at the language from a consistency point of view '?:' is very PERL-like whereas filled(...) is PHP-like: PERL-like: $x ~= s/\s+//; $x = $a ?: $b ?: $c; PHP-like: $x = preg_replace("/\s+/", "", $x); $x = filled($a, $b, $c); In my PHP zen world, empty() and filled() are friends. Ok, I've been selling 'filled()' for a while now. Can we reverse the sell and try this .. why SHOULDN'T filled() be added to the language? Dante