Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airframe-di: Next generation DI library #1649

Closed
xerial opened this issue May 14, 2021 · 1 comment
Closed

airframe-di: Next generation DI library #1649

xerial opened this issue May 14, 2021 · 1 comment
Labels
Milestone

Comments

@xerial
Copy link
Member

xerial commented May 14, 2021

  • Support only constructor injection!

    • If we use only constructor injection, no dependency to DI itself is necessary other than the design part
    • No need to worry about which injection to use (in-trait or constructor?). It will also reduce the learning cost. Half of the current documentation (https://wvlet.org/airframe/docs/airframe) will be unnecessary.
  • Deprecate in-trait bindings

    • For supporting Scala 3 at ease. Writing macros for nested trait instantiation is the tricky part. If we use constructor injection, the code will be much simpler
  • Migration plan

    • Retain the current airframe module as is.
    • Add a new module "airframe-di" so that the user can migrate to a new one at any timing.
    • The package name will be wvlet.airframe.di => Deprecate in-trait injection only from Scala 3! Use the same package name to reduce the confusion.
  • Usage stats of in-trait bindings (inside TD)

    • bind[X] a lot!!!
    • bindLocal[X] only a few times
    • bindFactory[X] only a few times
    • So dropping bindLocal, bindFactory should be ok.
@xerial
Copy link
Member Author

xerial commented May 15, 2021

Airframe DI for Scala 3 (without in-trait bindings) is released as 21.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant