Re: interface method visibility.

From: Date: Wed, 16 Nov 2005 17:34:18 +0000
Subject: Re: interface method visibility.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-20069@lists.php.net to get a copy of this message
Please read the archives where discussions took place. As you stated it would be "abusing" the notion of what interfaces are. Take a look at abstract classes. That might help you. Andi At 07:24 AM 11/16/2005, Jochem Maas wrote:
why does the engine care about the visibility of interface methods I declare? I understand the argument that interface methods only have 'meaning' when applied as public methods of objects - but thats rather academic and personally I can think of useful ways to abuse interfaces using protected methods at the very least why am I not allowed to do this just because someone decided that its not correct? and given that I can implement a non-static method without using $this or any other symbol/code related to the instantiated object (effectively creating a static method) which I can call using static notation why not allow static interface methods? also I noticed that using the keyword 'abstract' with a interface method declaration is all of a sudden (5.1RC5dev) causing a fatal error where before (5.0.2 - 5.0.4) no error what so ever. If 'static', 'protected', 'private' are not allowed with interfaces (very unpragmatic imho) then why the fatal errors? why not an E_STRICT and just ignore those declaration... especially because not declaring a method static and leaving off the visibility leaves you with a method that is non-static and public - exactly what an interface 'requires'. rgds, Jochem ---- some might ask why I am asking - well the motive is quite simple:
        "I try to stay on top of php developments, trying out to the best of my
        abilities new features whenever I see an opportunity. partly for fun, partly
        to be able to encourage/help others to step up to the php5 plate. lately I
        _feel_ I am being punished more and more for trying to keep abreast due to BC breaks
        (some of which, I realise, are very much required) and more annoyingly abitrary
        changes in behaviour."
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#20069) next »