Re: interface method visibility.
| From: | Wez Furlong | Date: | Wed, 16 Nov 2005 18:54:54 +0000 |
| Subject: | Re: interface method visibility. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-20075@lists.php.net to get a copy of this message | ||
An interface is a public contract that describes the behaviour of an object..
If you're not using interfaces in that way, you're doing something
fundamentally wrong.
--Wez
On 11/16/05, Jochem Maas <jochem@iamjochem.com> 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
>
>