Skip to content
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

Interfaces #2

Open
jchitel opened this issue Nov 9, 2017 · 0 comments
Open

Interfaces #2

jchitel opened this issue Nov 9, 2017 · 0 comments

Comments

@jchitel
Copy link
Owner

jchitel commented Nov 9, 2017

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
@jchitel jchitel self-assigned this Nov 9, 2017
@jchitel jchitel added this to To Do in Ren v0.1 via automation Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Ren v0.1
  
To Do
Development

No branches or pull requests

1 participant