-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Generics: Set associated constants using where
constraints
#1013
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me; soliciting broader input before approval.
Co-authored-by: Richard Smith <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some somewhat random thoughts here, but generally I really like this. I think its a great simplification & fix of a nagging issue. Super happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, approving mostly on @zygoloid 's review, but I also am really happy here. =]
Change the syntax for setting the associated constants and types in an interface implementation for a type from using `let` declarations as in: ``` class Vector(T:! Type) { impl as Iterable { let ElementType:! Type = T; ... } } ``` to using `where` clauses as in: ``` class Vector(T:! Type) { impl as Iterable where .ElementType = T { ... } } ``` This is an attempt to simplify by removing redundancy, improve consistency by removing a use of `let` that was different than other examples, and better support forward declaration that a type implements an interface while retaining the information needed for type checking. Co-authored-by: Richard Smith <[email protected]>
Change the syntax for setting the associated constants and types in an interface implementation for a type from using
let
declarations as in:to using
where
clauses as in:This is an attempt to simplify by removing redundancy, improve consistency by removing a use of
let
that was different than other examples, and better support forward declaration that a type implements an interface while retaining the information needed for type checking.