Thats fair, as long as it doesn't result in any unwanted behaviour then I'm +1.

-Rob

On 6/3/06, Marcus Boerger <[EMAIL PROTECTED]> wrote:
Hello Robert,

  well lazy is a good point here but __toString is all about lazyness.
Then again as said you might want to have objects naturally convert
to strings whereever possible. Generally when providing a __toString
implementation you say that you want this. And then you might as well
expect that your objects can be used as index to arrays.

The example is as said an object that can be used to calculate the
index to an array. Assuming you deal with persons derived from
a database as classes, your person objects might be implmeneted so
that __toString simply returns the name of the persons. Now when your
application also has an array that stores more information about the
persons it would be nice if you could access that array direectly by
your peson objects.

best regards
marcus

Saturday, June 3, 2006, 2:55:00 PM, you wrote:

> Hi,

> Is it really worth enabling a whole new area where problems could
> occur just for this? Can you provide an example of where it might
> actually be considered useful and not just being lazy?

> -Rob

> On 6/3/06, Marcus Boerger <[EMAIL PROTECTED]> wrote:
>> Hello Pierre,
>>
>>   ever thought that we use tests to check special behavior and that
>> those snippets have little to do with real applications? Obviously
>> not. The idea behind is that for instance you might use an array as
>> a translation and use an object to *calculate* the index.
>>
>> Saturday, June 3, 2006, 2:40:29 PM, you wrote:
>>
>> > Hi,
>>
>> > On 6/3/06, Marcus Boerger <[EMAIL PROTECTED]> wrote:
>> >> Hello guys,
>> >>
>> >>   the attached patch closes one more __toString() part. It allows
>> >> to use objects that define __toString as indexes to arrays. What do
>> >> you guys think about this, should we add it or stay with the old
>> >> behavior that didn't allow objects as indexes at all.
>>
>> > $arr[new Test] = 'abc';
>>
>> > makes very little sense to me, as well as
>>
>> > $a = new Test; $arr[$a] = 'abc';
>>
>> > Do we really want to support that?
>>
>> > --Pierre
>>
>>
>>
>> Best regards,
>>  Marcus
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>


> --
> Xnyo - http://xnyo.odynia.org/




Best regards,
 Marcus




--
Xnyo - http://xnyo.odynia.org/

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

Reply via email to