Hello Rodrigo,

Monday, December 8, 2008, 5:48:00 PM, you wrote:

>> Which reminds me that we still have no way to do that in userland.
>> In userland you cannot write:
>>   function foo(Object $bla = NULL).
>> The missing part is 'Object' as a type hint. I once long ago suggested
>> using 'class' as in 'any class member'. But people felt it wouldn't be
>> self explanatory enough. And unfortunately we cannot use 'Object' for
>> obvious reasons. We simply cannot turn that into a reserved word not
>> can we expect no one to have a class named Object already.
>> 
>> So my suggestion holds: Let's add type hint 'class' to allow hints for
>> objects.
>> 
>> marcus
>> 
>>>> This is my test code:
>>>>  ---- snip ----
>>>> <?php
>>>> class PropertyReflection extends ReflectionProperty {
>>>>     public function getValue(stdclass $object) {}
>>>> }
>>>> ?>
>> 
>>> Use public function getValue($object = null) {} instead.
>>> -- 
>>> Stanislav Malyshev, Zend Software Architect
>>> [EMAIL PROTECTED]   http://www.zend.com/
>>> (408)253-8829   MSN: [EMAIL PROTECTED]
>> 
>> 
>> 
>> 
>> Best regards,
>>  Marcus
>> 

> I don't think having a Object class built in is such a big issue with 
> namespaces around. Anyone using object type-hinting should have a clue.

I am not speaking of a built-in object class. Because that is not what the
internal parsing does. The internal parsing checks whether a passed-in
argument is an instance of any class or not. And we can never have one base
class. The engine simply would not allow that becasue it can take instances
created from classes provided by different back-ends including other
lanugae runtimes.

> --
> Rodrigo Saboya




Best regards,
 Marcus


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

Reply via email to