Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97564 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84648 invoked from network); 7 Jan 2017 19:29:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jan 2017 19:29:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 74.125.82.52 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:37494] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/E6-37836-AA141785 for ; Sat, 07 Jan 2017 14:29:46 -0500 Received: by mail-wm0-f52.google.com with SMTP id t79so71038582wmt.0 for ; Sat, 07 Jan 2017 11:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X0DKfWjbvmb1eLgi+ueSMq8h4jomMEqNeape9tmECiw=; b=gaUn0DjAZZ3wabLXGBmWTKXlcSq1kwi6D2nqgB/IZifkxFbwb6i90kco1PPHE22fhK JaHk7iE71Uo2EyNmD2upfrU0Kikgu5t168/FNo7C0x62lXBfjHCkD8xdtxCfcd4uecaC aZPG3E19mNHtnxabFa9ZN5fxcOAETCvihRdwVcLxCL8r2h3/0uTHtLXwGFFPSum/UlWI jrFxjWKK0HouUZLYfFRBRjJyIhAlXQOcBbyK7iwalUGSa8j11tI33Q9yoidafLHFWwVT VVIatb7tUL/JOUNegTjGqeP5/+SYHGAtqActqSxEeYySbbKjIV8+mLF/GsBj196lnAu2 5jRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X0DKfWjbvmb1eLgi+ueSMq8h4jomMEqNeape9tmECiw=; b=ZYzrdwNVFKqnhy9sUBp0rAFJPe241TSdCMm02bmAObmzKM/cZaAx/a6yniaI/CCw0n 7CmaYvFWBaP30jayhUrerfCA0DrAAJrWMJ69/Fz+fK4yNvR83ixvMhPbcdKsZwDB5uFj KIwHNp2XnIHGY7BNXLFsWvdfnlq4ya7K6aAfqjLx1ZnxrzSNKLhdzMjogVmZ+r3OoIVK Ax9SYvsWp2vF9WM7BR5QPRdO0efamDuultISJ+71PT2xrRTzL9UhhrZhmeWe/793lZv2 j4cFYEdr+sejyUfg5/As8xb9t7oH7Dzf02H1C/wrscyO08FacDHOEZwy667Rfz91mdL3 94qQ== X-Gm-Message-State: AIkVDXLIyIcxiZil+AVcn8K+RllC1gTFLpEgY/xmfF/Bdq8H1vzXMO+IHVgdUHyp7Ei1xP+s3MGlC06Z2gQXyw== X-Received: by 10.223.155.158 with SMTP id d30mr5723094wrc.99.1483817383167; Sat, 07 Jan 2017 11:29:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.176.4 with HTTP; Sat, 7 Jan 2017 11:29:42 -0800 (PST) X-Originating-IP: [86.178.168.203] In-Reply-To: <6925329b-3513-544a-2d40-6fcf402ebfff@gmail.com> References: <8e8f1cf4-a698-63b0-71a6-84daff20fdf2@gmail.com> <6925329b-3513-544a-2d40-6fcf402ebfff@gmail.com> Date: Sat, 7 Jan 2017 19:29:42 +0000 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c1b5334091fcf05458628f4 Subject: Re: [PHP-DEV] SimpleXML's atXPath method From: pthreads@pthreads.org (Joe Watkins) --94eb2c1b5334091fcf05458628f4 Content-Type: text/plain; charset=UTF-8 Evening Roawn, There is no competition to see which single problem we are going to solve, we can fix more than one thing, obviously :) What we are discussing here is the value of this particular feature, not the value of things that nobody has taken the time to propose, implement, or fix. This contributor has waited a year for this conversation to start, it would be nice if we could stay focused. If you would like to talk about the shortcomings in simplexml (or anything), might I suggest you start a new topic and see if you can drum up some support for changes/fixes :) Cheers Joe On Sat, Jan 7, 2017 at 6:24 PM, Rowan Collins wrote: > On 07/01/2017 17:01, Joe Watkins wrote: > >> Evening Rowan, >> >> I must protest: It is wasteful, unclear, and generally nasty, to create, >> return, and manipulate an array if you are only ever going to reference one >> element in code. >> > > Meh, feels like a micro-optimisation to me, and "[0] to access first > search result" seems pretty obvious, but fair enough if you disagree. > > I know development's not a zero-sum game, but there are plenty of things > I'd add to the SimpleXML extension that aren't just aliases for things you > can trivially do already. > > For instance, sticking with XPath usage, the fact that > registerXPathNamespace() only affects the current element, so has to be > re-run as you traverse: > > $sx->registerXPathNamespace('a', 'http://example.com'); > $foo = $xml->xpath('//a:foo')[0]; > // do something with $foo > $foo->registerXPathNamespace('a', 'http://example.com'); // won't work > without this > $bar = $foo->xpath('./a:bar')[0]; > > That's a lot more intrusive than needing to add "[0]" next to a few method > calls. > > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c1b5334091fcf05458628f4--