2010/4/15 Derick Rethans <der...@php.net>: > On Tue, 13 Apr 2010, Felix De Vliegher wrote: > >> >>>> Update: http://phpbenelux.eu/array_seek-return.patch.txt >> >>>> I've kept the fseek()-style return values (0 when fine, -1 when seek >> >>>> fails) >> >>> >> >>> Any reason why you picked that over the (IMO more logical) true/false >> >>> approach? >> >> >> >> No, it makes more sense to use the boolean return values, I was just >> >> using your fseek() analogy. Although I still find it useful to return >> >> the seeked value, and false when seek fails (basically how next(), >> >> reset() and friends behave). >> > >> > Has this been added to trunk now? Or not yet? >> >> No, still have it lying around. Can I commit this? > > Dunno... did you go with true/false in the end, or returning the value? > I just realize that in the latter case you wouldn't be able to see > whether the seek actually worked, because every value could be a > "correct" value. I'd prefer the true/false thing still because of that.
I realise that I'm late to the game here but do have a couple of thoughts. * The function name: this will go hand-in-hand with functions like current(), next(), prev(), key(), reset() rather than the other array_* functions... wouldn't "seek" be more appropriate given its siblings? * The return value: the purpose of the function is to seek, not to get what is at the seeked-to position (right?) so true/false (+ warning?) makes most sense to me. > > Derick > > -- > http://derickrethans.nl | http://xdebug.org > Like Xdebug? Consider a donation: http://xdebug.org/donate.php > twitter: @derickr and @xdebug > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php