Skip to content

Interfaces #2

Description

@jchitel

Interfaces

Dependencies: Overloads

New syntactic features:

New Tokens:

INTERFACE ::= interface

New NonTerminals:

InterfaceDeclaration ::= INTERFACE IDENT TypeParamList? LBRACE InterfaceMember* RBRACE
AnonInterfaceDeclaration ::= INTERFACE TypeParamList? LBRACE InterfaceMember* RBRACE
InterfaceMember ::= (Type IDENT) | (Type IDENT TypeParamList? ParameterList)

Extended NonTerminals:

Declaration ::= ... | InterfaceDeclaration
AnonDeclaration ::= ... | AnonInterfaceDeclaration

New semantic features:

  • Interfaces are a new kind of type associated with a name, closely related to structs
  • Any type with a matching field/method structure is assignable to the interface
  • This will add support for iteration of other types than just arrays, so these built-in interfaces will be supported
    • Iterable (provides a mechanism to get an iterator value from an type)
    • Iterator (returned by iterables, provides a mechanism for lazy iteration of containing values)

Transformation:

  • Being types, interfaces are not used during the transformation stage

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions