Hello Larry,

  ArrayAccess is not designed to work in any array functions and we
explicitly decided against going that route. We wanted ArrayAccess to
support the array syntax, so [x,y] should be supported if we want that.
However I agree that this kind of slicing is a bit too perlish or
pythonish.

marcus

Friday, October 5, 2007, 3:05:30 AM, you wrote:

> On Tuesday 02 October 2007, Alexey Zakhlestin wrote:
>> On 10/1/07, Martin Alterisio <[EMAIL PROTECTED]> wrote:
>> > Sorry to bother, I have a few questions on this matter.
>> > How will this impact on the SPL ArrayAccess and related interfaces and
>> > objects?
>> > Will there be an interface to this functionality?
>> > If so, how will ranges be passed through to this interface?
>> > Will this be consistent with substr() and array_slice() if used with an
>> > ArrayAccess implementation?
>>
>> I guess it can be made to work with current ArrayAccess, but result
>> will be quite slow. (it will need to query requested elements
>> one-by-one and recombine those in array)
>>
>> But adding another interface can solve the problem. Ranges can be
>> passed exactly the way they are passed to [] operator
>>
>> public function rangeGet($start, $length);
>> public function rangeSet($start, $length, array $data);

> Here's the question I see.  Right now, does an ArrayAccess object work with 
> array_slice()?  If so, then [2, 5] syntax would be just some nice syntactic 
> sugar.  If not, then it becomes a powerful new feature, and implementing it 
> on normal arrays and strings becomes just a matter of consistent syntax.

> Personaly I kinda like it, but I know I'm not the one coding it.  

> -- 
> Larry Garfield                  AIM: LOLG42
> [EMAIL PROTECTED]          ICQ: 6817012

> "If nature has made any one thing less susceptible than all others of 
> exclusive property, it is the action of the thinking power called an idea, 
> which an individual may exclusively possess as long as he keeps it to 
> himself; but the moment it is divulged, it forces itself into the possession
> of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
> Jefferson




Best regards,
 Marcus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to