@@ -4,16 +4,17 @@ package meta
44/**
55 * Intermediate factory that creates an `Instances` trait based on provided `Implicits`.
66 * Normally, this factory is used as implicit constructor parameter of base classes for companion objects
7- * of RPC traits (e.g. [[com.avsystem.commons.rest.DefaultRestApiCompanion DefaultRestApiCompanion ]]).
8- * This all serves to reduce boilerplate associated with RPC trait companion declarations and makes RPC trait
7+ * of RPC traits (e.g. [[com.avsystem.commons.rest.DefaultRestApiCompanion DefaultRestApiCompanion ]])
8+ * or ADTs (e.g. [[com.avsystem.commons.rest.RestDataCompanion RestDataCompanion ]]).
9+ * This all serves to reduce boilerplate associated with companion declarations and makes RPC trait or ADT
910 * definitions as concise as possible. It also lets the programmer easily inject additional implicits into
10- * macro-materialization of RPC-related typeclasses (`AsReal`, `AsRaw`, metadata, etc.) .
11+ * macro-materialization of typeclasses aggregated by `Instances` trait .
1112 *
1213 * `Instances` is a trait that aggregates multiple macro materialized typeclass instances.
13- * There is no fixed interface for `Instances`, its members are inspected by `materialize` macro and implemented
14- * automatically. `Instances` must contain only parameterless abstract methods. Return type of each method
15- * must have a companion object which contains `materialize` macro. That macro will be used to implement
16- * that method.
14+ * There is no fixed interface for `Instances`, its members are inspected by `MacroInstances. materialize`
15+ * macro and implemented automatically. `Instances` trait must have only parameterless abstract methods.
16+ * Return type of each method must have a companion object which contains `materialize` macro.
17+ * That macro will be used to implement that method.
1718 *
1819 * Example of `Instances`: [[com.avsystem.commons.rest.ClientInstances ClientInstances ]]
1920 *
@@ -24,7 +25,10 @@ package meta
2425 *
2526 * If `MacroInstances` is accepted as implicit super constructor parameter of a companion object
2627 * (which is the typical situation) then `this` reference should be passed as `companion`.
27- * This is in order to work around https://github.com/scala/bug/issues/7666
28+ * This is in order to work around https://github.com/scala/bug/issues/7666.
29+ * Actual typeclass instances aggregated by `Instances` trait should be extracted into `implicit lazy val`
30+ * definitions in the companion base class. See e.g. [[com.avsystem.commons.rest.RestDataCompanion RestDataCompanion ]]
31+ * for an example of how it's done.
2832 */
2933trait MacroInstances [Implicits , Instances ] {
3034 def apply (implicits : Implicits , companion : Any ): Instances
0 commit comments