Skip to content

Missing "plus" operator for Lazy<Module> #1755

@cpaleop

Description

@cpaleop

Is your feature request related to a problem? Please describe.
The Module class implements the "plus" operator which can be widely used in a codebase. Given a migration path to lazy APIs (meaning migrating from using module {} to lazyModule {}) there is no equivalent API for using "plus" operator.

Describe the solution you'd like
A "plus" operator for Lazy<Module> similar to what Module has.

Describe alternatives you've considered
Given a migration path there are no well-suited alternatives. Parity of operators should exist between Lazy<Module> and Module.

Target Koin project
core

Note - Broken migration path

Considering the current implementation of the lazy modules, regardless of where the operator is implemented the migration path of a consumer from non-lazy to lazy APIs will require the addition of an import statement even though the "plus" operator of a Module does not (since the operator is implemented as a member of the class and not as an extension function). This is a side effect of not having a class for a "lazy module".

My suggestion as an overall improvement would be to create a LazyModule class that implements Lazy<Module> in order to:

  1. Be compatible with the current APIs
  2. Leverage delegation in order to implement Lazy logic
  3. Having the option to keep parity between Module and LazyModule implementations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions