Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Restrictions on interface methods should be clarified #94

Open
ericlippert opened this issue Jun 26, 2017 · 0 comments
Open

Restrictions on interface methods should be clarified #94

ericlippert opened this issue Jun 26, 2017 · 0 comments

Comments

@ericlippert
Copy link
Contributor

The text of chapter 17 on interface methods says

"Methods declared in an interface must not be declared abstract."

That's correct but incomplete. We should add to this:

  • Methods declared in an interface may be static.

This is good to point out because many languages do not allow static interface methods.

  • Methods declared in an interface must not be declared protected or private.

Clearly it makes no sense to have a protected or private interface member; they're implicitly public.

  • Methods declared in an interface may be marked public.

HHVM allows the "public" to be elided, even though technically that is not quite grammatical. I think that's a reasonable rule.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant