Changeset f7b9faf for doc/proposals
- Timestamp:
- Jun 26, 2017, 1:05:32 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 6385d62
- Parents:
- 74e58ea3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/proposals/associated_types.md
r74e58ea3 rf7b9faf 50 50 ### Nominal Inheritance ### 51 51 52 This trait specialization syntax could also be used, with a new type of type assertion, to provide nominal inheritance of traits, e.g:52 This trait specialization syntax could also be used, with a new annotation on the traits, to provide nominal inheritance of traits, e.g: 53 53 54 trait random_access_iterator(otype I | forward_iterator(I)) { 55 nominal; // not sure what the keyword is here, could maybe overload auto or extern 56 }; 54 extern trait random_access_iterator(otype I | forward_iterator(I)) {}; 57 55 58 56 forall(otype T) random_access_iterator(vector_iter(T)) {}; 57 58 I used `extern` here to not add a new keyword, I think it fits the idea of "the definition is somewhere else" of the existing meaning of `extern`. Other options include a zero-arg pseudo-trait `nominal()` that could go in the trait's constraint list.
Note: See TracChangeset
for help on using the changeset viewer.