On 18.06.2010, at 16:13, Melanie Rhianna Lewis wrote:

> 
> 
> On 17 Jun 2010, at 20:14, Stas Malyshev wrote:
> 
>> Hi!
>> 
>>> I know the discussion is about scalar type hints. But what is with a
>>> object type hint as base for all objects?
>> 
>> When it makes sense to accept any object, regardless of the class, but not 
>> other types? I wonder if it's really a common use-case.
> 
> Its useful in some patterns.  For example suppose you have a pattern where a 
> class wraps another class.  The wrapped class could be *any* class if you're 
> modify the behaviour of some default methods (say doing something like a 
> decorator pattern).  Having a type hint that recognises object vs non objects 
> is useful.


isnt this what interfaces are for?

regards,
Lukas Kahwe Smith
m...@pooteeweet.org




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

Reply via email to