Currently the approach for defining the dependency is not very comfortable when defining a not required dependency.
dependency :my_dependency,
default: DefaultDependency,
type: MyType,
required: false | true
When the dependency is not required you have to pass a default otherwise it will error out, which proved to be non-optimal when dependencies are so not required there is even no default implementation.
The correct way to handle this seems to be the following:
- When dependency is required - you have to pass it, if there is no default - it will error out
- When the dependency is not required - if it's not passed and there is no default just evaluate the variable to
nil
That way we can have it more flexible.
Currently the approach for defining the dependency is not very comfortable when defining a not required dependency.
When the dependency is not required you have to pass a default otherwise it will error out, which proved to be non-optimal when dependencies are so not required there is even no default implementation.
The correct way to handle this seems to be the following:
nilThat way we can have it more flexible.