-
-
Notifications
You must be signed in to change notification settings - Fork 378
Mention relation of interfaces to member fields #3104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
639258b
5d7830e
f573d76
c94a857
347f1f6
cf4e9b8
822d405
3e3407a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,9 @@ $(SPEC_S Interfaces, | |
|
||
$(HEADERNAV_TOC) | ||
|
||
$(P An $(I Interface) describes a list of functions that a class which inherits | ||
from the interface must implement.) | ||
$(P An $(I Interface) abstracts from common behaviour in terms of an abstract class | ||
which doesn't expose implementation details of methods and object state. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the previous sentence should probably be joined together. The "it's" is a bit jarring. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe: "An Interface abstracts from behaviour in terms of an abstract class which ..." I originally intended to use simple English but less text is surely reasonable as long as it's comprehensible. If you have write access to this PR, you are welcome to do the change. I can do this only later on another device. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @maxhaton I integrated your changes with my ones. |
||
Classes which inherit from an interface must implement the functions signatures.) | ||
christoph-ehm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$(GRAMMAR | ||
$(GNAME InterfaceDeclaration): | ||
|
@@ -39,7 +40,7 @@ $(GNAME BaseInterfaceList): | |
to that interface.) | ||
|
||
$(P Interfaces cannot derive from classes; only from other interfaces. | ||
Classes cannot derive from an interface multiple times. | ||
Classes cannot derive from the same interface multiple times. | ||
) | ||
|
||
------ | ||
|
@@ -78,6 +79,19 @@ interface D | |
static void foo() { } // ok | ||
final void abc() { } // ok | ||
} | ||
------ | ||
|
||
$(P Non-static member fields may not be defined in interfaces. | ||
) | ||
|
||
------ | ||
interface D | ||
{ | ||
static immutable e = 2.71828f; // ok | ||
float f; // error, variable `f` field not allowed in interface | ||
immutable g = 3.81f; // error, variable `g` field not allowed in interface | ||
enum h = 6.626f; // ok, compile-time-static symbols are considered static | ||
} | ||
------ | ||
|
||
$(P Interfaces can have function templates in the members. | ||
|
Uh oh!
There was an error while loading. Please reload this page.