This repository has been archived by the owner. It is now read-only.

Freezing of the factory #16

kitsonk opened this Issue Jan 5, 2016 · 1 comment


None yet
1 participant

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: 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 the discussion label Jan 5, 2016

@kitsonk kitsonk added this to the alpha.2 milestone Mar 11, 2016

@kitsonk kitsonk modified the milestones: 2016.04, alpha.2 Apr 8, 2016


This comment has been minimized.

Show comment
Hide comment

kitsonk Apr 8, 2016


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


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 Apr 8, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.