You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mill's Cross Modules are implemented with a macro that generates a class, and a factory function that creates a new instance of the class given some context.
// user codetraitMyCrossModuleextendsCross.Module[String]
objectmyCrossextendsCross[MyCrossModule]("foo", "bar")
// simplified generated code as part of implicit conversion from `"foo"` to `Factory[MyCrossModule]`
factoryArgs.map[MyCrossModule]({ (arg: "foo") =>classC(ctx: Context) extendsMyCrossModulewith mill.Module(using ctx) {
defcrossValue:String= arg
}
(classOf[C], ctx =>newC(ctx))
})
The new class has to be generated via Macro, not quotes and splices, because the Specific cross module trait is not known statically.
The problem is that there is no way via Symbol.newClass to add the necessary (ctx: Context) parameter to the generated class C
Expectation
Allow to customise the parameters of the class, even if its just single term parameter list, I think generic is less needed because the macro can specialise the types.
The text was updated successfully, but these errors were encountered:
Compiler version
3.5.1
Minimized example
Mill's Cross Modules are implemented with a macro that generates a class, and a factory function that creates a new instance of the class given some context.
The new class has to be generated via Macro, not quotes and splices, because the Specific cross module trait is not known statically.
The problem is that there is no way via
Symbol.newClass
to add the necessary(ctx: Context)
parameter to the generated classC
Expectation
Allow to customise the parameters of the class, even if its just single term parameter list, I think generic is less needed because the macro can specialise the types.
The text was updated successfully, but these errors were encountered: