Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97140 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10658 invoked from network); 23 Nov 2016 06:19:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2016 06:19:56 -0000 Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:40290] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/C0-05808-A0535385 for ; Wed, 23 Nov 2016 01:19:55 -0500 Received: from [10.0.1.23] (unknown [183.89.45.163]) by mail1.25mail.st (Postfix) with ESMTPSA id 62C3560ACF; Wed, 23 Nov 2016 06:19:43 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: Date: Wed, 23 Nov 2016 13:19:43 +0700 Cc: Nikita Popov , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Wes X-Mailer: Apple Mail (2.3124) Subject: Re: [PHP-DEV] [RFC] ArrayIterator improvements From: php-lists@koalephant.com (Stephen Reay) Hi, Given that this new method seems closely related to ArrayIterator::seek, = I (as a userland developer) would very much expect it to handle error = conditions in the same way. In the case of ArrayIterator::seek - it throws an OutOfBoundsException. = I don=E2=80=99t see how that isn=E2=80=99t appropriate for seekKey? Cheers =20 Stephen > On 23 Nov 2016, at 04:56, Wes wrote: >=20 > I have decided to go with that because >=20 > 1- I'm a fan of using Exceptions (mostly) for exceptional error = conditions; > between these two > public seekKey($key):void throws WhateverException; > public seekKey($key):bool; > I (by far) prefer the latter. >=20 > 2- I think it would require a new type of SPL Exception, because none = of > the existing makes sense to use here, in my opinion. >=20 > 2016-11-22 21:43 GMT+01:00 Nikita Popov : >=20 >> On Tue, Nov 22, 2016 at 6:47 PM, Wes wrote: >>=20 >>> Greetings again PHPeople, >>>=20 >>> I wanted to avoid the discussion for the small improvements I was >>> proposing >>> thinking it would be acceptable to do so ( >>> http://news.php.net/php.internals/97118) but apparently I was wrong >>> (sorry >>> for that), so here's the discussion thread! >>>=20 >>> https://wiki.php.net/rfc/arrayiterator-improvements >>>=20 >>> Again this is my first RFC, and I hope I'm doing nothing wrong this = time >>> :P >>>=20 >>> Thanks again, >>> Wes >>>=20 >>> (and special thanks to Room11 for their feedback about the RFC = process) >>>=20 >>=20 >> What's the reason for making seekKey() return a boolean? The existing >> seek() method throws an exception if the seek offset does not exist. = It >> would make sense to me for seekKey() to throw an exception if the key = does >> not exist, to keep things consistent. >>=20 >> Nikita >>=20 >>=20