Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Statements > Definition statements > Interfaces

Interfaces

Interface definition defines an interface type. Interfaces can contain imports, constants, variables, interface methods, functions and interfaces.

The Interface method does not contain a method body; instead, they serve as a prototype for classes implementing interfaces.

Ordinary function declaration must be prefixed with ``staticยดยด keyword to create a (static) function.

Interface may extend one or more other interfaces, referred to with a dotted name. xxx.

  entity := ( "module" "." symbol | symbol ) ( "." symbol ) * 
  interface :=  
    "interface" symbolname   
    "extends" [ entityinterface ( "," entityinterface ) * ] 
    "{"  
       ( import 
       | constant  
       | variable 
       | "static" function 
       | interface-method  
       | interface 
       )*  
    "}" 
    
  arguments        := [ argument ( "," argument )* ] [ ".." symbolcollector ] 
  argument         := symbolname [ = exprconstant ] 
  interface-method := "function" symbolname  "(" arguments ")" ";" 
See also  | Import  | Definition statements  | Classes  | Modules  | Grammar
Contributes notes:
Add a note
What's new | Anvil