macwire icon indicating copy to clipboard operation
macwire copied to clipboard

Documentation - factories - usage not shown

Open ygor-sk opened this issue 7 years ago • 3 comments

The section on factories shows two alternatives on how to define a factory:

def taxCalculator(taxBase: Double) = wire[TaxCalculator]
    // or: lazy val taxCalculator = (taxBase: Double) => wire[TaxCalculator]

It does not show though, how a class can depend on such factory.

This answer on SO shows, how to inject a factory defined in a val (or lazy val) - second line in the documentation snippet

However, I have found no way on how to inject a factory, which is defined using a def - first line in the documentation snippet.

ygor-sk avatar Oct 03 '18 08:10 ygor-sk

Depending on taxBase: Double => TaxCalculator (the function type) doesn't work? If not, than it's a bug.

adamw avatar Oct 03 '18 12:10 adamw

Am I using it as intended ?

https://gist.github.com/ygor-sk/b8e64fc68627fe9a2930d78829147004

ygor-sk avatar Oct 03 '18 12:10 ygor-sk

Yes, seems there's a bug or a missing feature :)

adamw avatar Oct 03 '18 13:10 adamw