Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Freezing of the factory #16

Closed
kitsonk opened this issue Jan 5, 2016 · 1 comment
Closed

Freezing of the factory #16

kitsonk opened this issue Jan 5, 2016 · 1 comment
Milestone

Comments

@kitsonk
Copy link
Member

kitsonk commented Jan 5, 2016

Originally, I thought it was wise to freeze the returned factory, basically to keep factories immutable, and limit the amount unanticipated consequences. The challenge is that it makes it impossible to add static methods/properties to the factory.

There are three approaches I can see to resolving this:

  • Don't recommend/support static properties or methods. If the default export of a module is a factory, it is "better" from a potential code optimisations mechanism, to export static methods related to the factory as part of the module. Of course, this may not gracefully handle typing with downstream composites.
  • Don't freeze the factories
  • Add an API to allowing the addition of static properties. The challenge will how to handle the type inference to return an extension of the ComposeFactory. Likely we would need TS 1.8 with F bound polymorphism (see: Type parameters as constraints microsoft/TypeScript#5949).

If we choose either of the last two, we will have to change the factory cloning logic to perpetuate these static method/properties, which it currently does not do.

@kitsonk kitsonk added this to the alpha.2 milestone Mar 11, 2016
@kitsonk kitsonk modified the milestones: 2016.04, alpha.2 Apr 8, 2016
@kitsonk
Copy link
Member Author

kitsonk commented Apr 8, 2016

@maier49 has implemented as much of a level of freezing as we have felt safe but still workable.

@kitsonk kitsonk closed this as completed Apr 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant