Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32300 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72369 invoked by uid 1010); 12 Sep 2007 17:53:14 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 72354 invoked from network); 12 Sep 2007 17:53:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2007 17:53:14 -0000 Authentication-Results: pb1.pair.com header.from=shearer.andrew@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=shearer.andrew@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.190 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: shearer.andrew@gmail.com X-Host-Fingerprint: 209.85.198.190 rv-out-0910.google.com Received: from [209.85.198.190] ([209.85.198.190:4667] helo=rv-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/C0-00780-88728E64 for ; Wed, 12 Sep 2007 13:53:13 -0400 Received: by rv-out-0910.google.com with SMTP id k15so254721rvb for ; Wed, 12 Sep 2007 10:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=Wuf98EfjLmJmQbT4F4yStXHX6oBEIzggi5x1Mx9CTfs=; b=DhGCjdhudu3ao6JLQwjaOWygjF3iftUk6FXG3WbemcPTiEiN5CZG1ZIWBHkWsMKmQPHOpUsAq1DkWEY80d0bsh83lcgzQwQHRn1pgI9Xh1mEI76wQCBd7i7+N2kwLXSaWzqh08krvf3Z7drgcjf7NO5a7xPCmJ2RPwK3d1wZJLU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=U1ckP2tYd47pTon8pHqK9iTj7NnWKwI7cV5XPx/SQCgslMxFl5WCdIRKfvuG9hd7eqWXR4z9B2R4Jq0rPwrLy4aYDk1A4OQckTEqFa4D+eMHsNXfL450M0Uo0RaJhxGLUcjepaAqGuSiBRAlXBCpe+yGjRlyjW4lbh+gLNF9itI= Received: by 10.141.90.17 with SMTP id s17mr2384rvl.1189619589151; Wed, 12 Sep 2007 10:53:09 -0700 (PDT) Received: by 10.141.41.10 with HTTP; Wed, 12 Sep 2007 10:53:09 -0700 (PDT) Message-ID: <17c19be0709121053u617071beq8d420926f60db46f@mail.gmail.com> Date: Wed, 12 Sep 2007 13:53:09 -0400 Sender: shearer.andrew@gmail.com To: "Marcus Boerger" Cc: "Robert Cummings" , internals@lists.php.net In-Reply-To: <421016323.20070912101332@marcus-boerger.de> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7778_5590872.1189619589176" References: <27DA5A7A-276C-480F-A75C-7F64BB38316B@ashearer.com> <142319111.20070911112759@marcus-boerger.de> <1262949578.20070911172112@marcus-boerger.de> <17c19be0709110933m537df263pfae99322b8ae0b32@mail.gmail.com> <702402878.20070911185402@marcus-boerger.de> <1189531022.30041.88.camel@blobule> <421016323.20070912101332@marcus-boerger.de> X-Google-Sender-Auth: aa475973f2b81586 Subject: Re: [PHP-DEV] [PATCH] array_get() From: andrew@ashearer.com ("Andrew Shearer") ------=_Part_7778_5590872.1189619589176 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/12/07, Marcus Boerger wrote: > > Hello Robert, > > yeah ifsetor if much better than the @-?: combination. But for 5.3 that > would be all we could do. For 6 and in the long run we might do a real > ifsetor. If ever we could come to a consensus... and no i don't really > like > to restart discussions on ifsetor at this point. It was my understanding that ifsetor had been rejected long ago, after going around the list a few times after your proposal of it in 2004. I'd hate to hold up other language progress in the hopes of eventually restarting discussion on it, unless you'd like to bring a modified proposal now. Meanwhile, array_get() provides the most-needed functionality while avoiding the issues that prevented ifsetor's acceptance. There's a backward compatibility problem with ifsetor: its special syntax means that there's no way to write a pure-PHP userland version of it. The effect is that there's no upgrade path for applications that have to straddle both old and new versions of PHP, and practical usefulness of ifsetor would be delayed for years after release. Of course, accepting array_get() now would not preclude bringing up ifsetor again someday on its unique merits. Here is the patch and unit test file for array_get(): http://ashearer.com/software/array_get/2007-09-10-php6/array_get.diffhttp://ashearer.com/software/array_get/2007-09-10-php6/array_get.phpt And here is the backward compatibility function: if (!function_exists('array_get')) { function array_get($arr, $key, $default = false) { if (array_key_exists($key, $arr)) { return $arr[$key]; } else { return $default; } } } Tuesday, September 11, 2007, 7:17:02 PM, you wrote: > > > On Tue, 2007-09-11 at 18:54 +0200, Marcus Boerger wrote: > >> Hello Andrew, > >> > >> how about @?: style? > >> > >> Like: $val = $myarray[$key] ?: $default; > > > Did you mean like: > > > @$val = $myarray[$key] ?: $default; > > > Because that's an expensive assignment since it will hit the error > > handler when the index is not assigned. I thought the ifsetor system was > > going to throttle undefined index notices for the left operand. > > > Cheers, > > Rob. > Best regards, > Marcus > > ------=_Part_7778_5590872.1189619589176--