On 21/02/12 19:03, Ralf Lang wrote:
>>> I see no reason why it would be not desirable to have PHP raise the
>>> exception rather than putting more or less repeating code snippets all
>>> around the place. That is why I am asking.
>>
>> You must be returning false/null somewhere. It's the same effort to
>> instead throw an exception or to return a Ghost family member.
>
> The $baby->mother() method cannot know if the using code just wants to
> collect the $mother object or execute code on it. It can also not know
> if having no $mother is a problem or just a fact to deal with.
> Unconditionally raising an exception is a bit overkill here, at least
> if we would get an exception for trying to access (null)->mother();
>
> Currently the user code must check each link of the chain if it is
> available, although it is only interested if it can get the final
> result or not.
>
> I'll follow the suggestion and write an RFC.
return new NoMother;





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

Reply via email to