|author||Michael Forney <email@example.com>||2017-07-01 14:43:22 -0700|
|committer||Ori Bernstein <firstname.lastname@example.org>||2017-07-03 23:27:02 -0700|
Specialize impl declarations on impl type in addition to decl type
This allows multiple specializations of a declarations with a concrete type, which can be selected with the new impl expression if it can't be deduced by its type alone. For example trait hasname @t = Name: byte[:] ;; impl hasname void = Name = "somename" ;; impl hasname bool = Name = "othername" ;; const boolname = impl(Name, void) To do this, pass the param type through to genericname and specializedcl. Since we now need the type parameter to look up trait decls, make sure n->expr.param gets the necessary treatment in typesub, specializenode, pickle, and unpickle. We also need to tag the param types for export.
Diffstat (limited to 'doc')
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/lang.txt b/doc/lang.txt
index 3be5500..d71bb70 100644
@@ -1268,7 +1268,9 @@ TABLE OF CONTENTS:
An impl expression chooses the implementation of the given trait
declaration for the given type. It is useful for refering to trait
- declarations in a generic context.
+ declarations in a generic context. It also allows you to
+ disambiguate a trait declaration whose type does not refer to the
+ trait parameter.
5.2.4. Cast Expressions: