Marcus, thanks for the heads ups.

I actually did have a (convoluted) example of using protected/private on interface methods, but reading your explaination makes it clear that there is a Better Way(tm).

static in interfaces does indeed seem valid: I hope that finds its way into 'the fold'.

kind regards,
jochem

Marcus Boerger wrote:

...


I would be very grateful if you could explain the logic behind not being able to define public/protected/private/static access modifiers for interface methods (obviously they are abstract by definition).


AFAICS (not that far I admit!) not being able to define public/protected/private/static for interface methods removes a lot of the power of interfaces (in terms of being able to define specifics)


What you want is enforcing a special visibility in the implementing class.
But first you could increase the visibility which makes it worthless and
second it would mean that from an interface point of view you won't be able
to use those methods. So what's the point? And btw think first, why are
you asking for private in interfaces? Such a method can nowhere be
implemented and also abstract and private alone never mix.

Another thing is static in interfaces. Maybe we'll allow that later.

regards
marcus


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



Reply via email to