Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46152 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72782 invoked from network); 22 Nov 2009 02:13:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2009 02:13:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=dante@lorenso.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dante@lorenso.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lorenso.com from 209.85.211.197 cause and error) X-PHP-List-Original-Sender: dante@lorenso.com X-Host-Fingerprint: 209.85.211.197 mail-yw0-f197.google.com Received: from [209.85.211.197] ([209.85.211.197:56845] helo=mail-yw0-f197.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/0F-13841-54E980B4 for ; Sat, 21 Nov 2009 21:13:25 -0500 Received: by ywh35 with SMTP id 35so4066148ywh.7 for ; Sat, 21 Nov 2009 18:13:22 -0800 (PST) Received: by 10.91.103.6 with SMTP id f6mr4711853agm.100.1258856002375; Sat, 21 Nov 2009 18:13:22 -0800 (PST) Received: from ?192.168.1.66? (99-147-139-38.lightspeed.allntx.sbcglobal.net [99.147.139.38]) by mx.google.com with ESMTPS id 22sm1353843yxe.3.2009.11.21.18.13.20 (version=SSLv3 cipher=RC4-MD5); Sat, 21 Nov 2009 18:13:21 -0800 (PST) Message-ID: <4B089E43.4050205@lorenso.com> Date: Sat, 21 Nov 2009 20:13:23 -0600 Reply-To: dante@lorenso.com User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Lukas Kahwe Smith CC: Rasmus Lerdorf , Alban , internals@lists.php.net References: <17.CC.25743.CB6770B4@pb1.pair.com> <84B23126-8011-48DA-B65A-750AA9C5B57E@pooteeweet.org> <4B082F9E.6080703@lerdorf.com> <3982afa90911211329k374ae22co35517e67d7e40f0f@mail.gmail.com> <0D57ED30-E1A5-4F82-9FAE-AB515FB8CAFF@pooteeweet.org> In-Reply-To: <0D57ED30-E1A5-4F82-9FAE-AB515FB8CAFF@pooteeweet.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] suggestion about ternary operator From: dante@lorenso.com ("D. Dante Lorenso") Lukas Kahwe Smith wrote: > On 21.11.2009, at 22:29, Dante Lorenso wrote: > >> I would love to restate my recommendation for the function "filled". >> Which is the opposite of "empty". Filled would accept a variable >> number of arguments and return the first where empty evaluates as >> false. >> >> Like empty, filled would not throw notices for undefined variables. >> This is not the same as the ifsetor debate because filled is opposite >> empty and cares not about isset. > > > did you even read the RFC? Yes I did, and all I see is this in the References section: "Suggestion to leave an empty() variant out of the picture since this feature can be implemented in userland, though this of course not provide the full functionality of empty() which does not trigger notices for missing variables" I didn't see my proposal listed in it anywhere. See this recommendation from 3 1/2 years ago: - May 03, 2006 http://www.mail-archive.com/internals@lists.php.net/msg21617.html Can someone please add the 'filled' proposal to the RFC? I find 'filled' way more useful than 'ifsetor' because in everyday code, I am constantly wanting to assign default values to variables that don't have values for a variety of reasons. The assignment of a default value happens before input filtering. $email = filled( $_REQUEST['email'], $CONFIG->email_default, $class_email, 'default@domain' ); Give me the first non-empty value and don't throw NOTICE warnings about it. Otherwise, I need all this: $email = !empty($_REQUEST['email']) ? $_REQUEST['email'] : ( !empty($CONFIG->email_default) ? $CONFIG->email_default : ( !empty($class_email) ? $class_email : 'default@domain' )); Yuck. -- Dante ---------- D. Dante Lorenso dante@lorenso.com 972-333-4139