[Fwd: Re: php 5 interfaces]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tbird switched the reply and reply-all buttons again ;-)...

?> IMHO its normally to use access type for methods declaration in interfaces. Why not?
Maybe my first example was not sufficiently illustrative. But my question was "why it does not work in one environment and work fine in another".

it worked for a while because it was originally overlooked, then they 'fixed' it. -- you may not agree with the devs.

The problem has acquired when i try to add "static" in my interface definition. I don't think that this is a bug in PHP. I just want to be deep insight in OOP of PHP5 engine.


your right, its not a bug - although some have argued that its Sucks(tm).

in short it was decided by the devs that interfaces are not meant for
static classes, they only apply to objects - which is why 'static' is
not (no longer) allowed on interface methods. if you want to know more
then digging into the php internals mailing list archives will give you
long discussions and justifications as to why it works they way it does.

if you think about it you can see where they are coming from: passing
around classes (i.e. classNames) and then checking whether said class
implements something is really odd, instead you pass around objects.

or more simply:

class == blueprint
object == house

you can interface with a house (lets hope your house IMPLEMENTS a door
interface!) but you can't interface with a blueprint (possibly with the
piece of paper it may be printed on but not with the actual blueprint)
because the blueprint is an idea/concept.

hope that helps you to understand the rationale.

rgds,
JOchem



...



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux