Re: Multi-Method Dispatch in PHP 5.1?
| From: | Marcus Boerger | Date: | Thu, 22 Apr 2004 08:03:36 +0000 |
| Subject: | Re: Multi-Method Dispatch in PHP 5.1? | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9482@lists.php.net to get a copy of this message | ||
Hello Jason,
no. Object can be a classname, Class not.
The reason gettype returns "object" is becuase an instance of a class is an
object. In typehinting we deal with the class-types and for things like
reflection we need a typehint that accepts any class but nothing else.
marcus
Thursday, April 22, 2004, 2:15:01 AM, you wrote:
> Just a note,
> Would "Object" be more appropriate than "Class"? The expected variable
> type is an object (defined by a class), and the gettype() function returns
> 'object'..
> # php -r '$x=new stdclass(); var_dump(gettype($x));'
> string(6) "object"
> It may mean adding a new reserved word though.
> ~Jason
> At 4/22/2004 01:29 AM +0200, Marcus Boerger wrote:
>>Hello Andi,
>>
>>the patch is here. It's a bit outdated but shouldn't cause much
>>problems to apply after RC2. It allows "Class", "Array" but atm
>>misses "Resource".
>>
>>marcus
>>
>>Wednesday, April 21, 2004, 11:50:46 AM, you wrote:
>>
>> > At 03:29 PM 4/20/2004 -0400, George Schlossnagle wrote:
>>
>> >>On Apr 20, 2004, at 3:18 PM, Marcus Boerger wrote:
>> >>>>The problem with this is that that integer may well be a string when
>> >>>>you look at it. There's no good way to do this past discriminating
>> >>>>between scalar, array and object (by type, of course). I personally
>> >>>>think that that is fine (adding an array typehint would be nice).
>> >>>
>> >>>Somewhere at my server should be a patch for "array". For some reason
>> >>>i was too lazy to ask for that to commit again before RC1. I you still
>> >>>want this just ask Andi/Zeev again.
>> >>
>> >>Andi/Zeev,
>> >>
>> >>Thoughts on allowing array typehinting?
>>
>> > I don't have a problem with array type hinting but I want to roll RC2. I
>> > suggest we look at Marcus' patch after RC2 and see if it's small enough to
>> > allow the inclusion before 5.0.0.
>>
>> > Andi
>>
>>
>>
>>--
>>Best regards,
>> Marcus mailto:helly@php.net
>>
>>--
>>PHP Internals - PHP Runtime Development Mailing List
>>To unsubscribe, visit: http://www.php.net/unsub.php
--
Best regards,
Marcus mailto:helly@php.net