softwaremill / softwaremill/macwire
wire all implementations of given base trait/class
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 77
- Avg merge
- 9m
- Merged PRs (30d)
- 4
Description
building on the example of multi-wiring via wireSet would it be possible to achieve this:
trait Musician
class RockBand(musicians: Iterable[Musician])
class Singer extends Musician
class Guitarist extends Musician
class Drummer extends Musician
class Bassist extends Musician
trait RockBandModule {
lazy val musicians: Iterable[Musician] = wireAll[Musician] // all above musicians classes will be instantiated
lazy val rockBand = wire[RockBand]
}
namely: have a wireAll[Base] method to instantiate all non-abstract classes derived from Base
it would be handy not to have to list all implementations (as in the wireSet example) of given trait and have it wired automatically so in case you add more implementations they will be added to the collection without any modifications to the module code
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked multi-wiring via wireSet example and inspect the existing wireSet API. Determine how a wireAll[Base] entry point should discover and instantiate all non-abstract implementations, including implementations added later. Done means the RockBand example can obtain the complete collection without listing each implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100