nfroidure / nfroidure/knifecycle

Consider changing some internal services to singletons

Open
#129 1 comment 0 reactions 1 assignee View on GitHub

@nfroidure is already working on this.

Since Aug 16, 2023.

enhancement question
Dominant language
TypeScript
Stars
34
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Some services, like $fatalError should probably be singletons since they concern the processes (its only use is atm here:
https://github.com/nfroidure/common-services/blob/main/src/process.ts#L84-L88

Some other ain't that simple to determine INJECTOR and SILO_CONTEXT are not singletons and it looks difficult to change their nature:
https://github.com/nfroidure/knifecycle/blob/86a34ca367a13cbfa62def2a98bca0a5d0fdd180/src/index.ts#L397-L398

Maybe that the autoloader itself should not be a singleton and be tied to its silo context? That said since initializers are the same for all silos, the autoloader would be a singleton that finally load the same things for each silos? Weird... Or not?

Have to think about it more, let's not include it into the v16.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.