-
Notifications
You must be signed in to change notification settings - Fork 65
Interface Syntax
JonathanAldrich edited this page Oct 9, 2012
·
3 revisions
Points of Agreement
- interfaces will be declared separately
- method signatures
- property signatures (separate from methods) - accessed with field syntax
- uniform access principle: properties can be implemented as methods
- keywords used to distinguish methods, properties, and (probably) types
- a default constructor is called using name of interface
- may want to support non-default constructors with different names
- T? indicates an option T
Example
interface Stack
type T
prop top : T?
def push(T)
def pop() : T?
Questions
- how to define type parameters?
- Jonathan's bias: type members, with sugar Stack
- what are the keywords? One proposal:
- def (method)
- val (immutable)
- prop (may change, but not directly assignable)
- var (assignable)
- type