Remix.run Logo
1718627440 4 days ago

> a factory can vary the return type, unlike a plain constructor

That's a language limitation and has nothing to do with the design pattern. You can do this just fine e.g. in Python.

idontwantthis 4 days ago | parent [-]

You could do that more or less in Javascript by creating and initializing different member variables in the constructor depending on a constructor argument but I would hate you for it.