composablesys / collabs

Collabs library monorepo
https://collabs.readthedocs.io/
Apache License 2.0
256 stars 11 forks source link

"of" methods on interfaces, for default implementations #115

Closed mweidner037 closed 1 year ago

mweidner037 commented 3 years ago

To mitigate possible doc overload from many implementations: have a static "of" method on each interface that returns a reasonable default implementation. E.g. AddWinsSet for non-Crdt types; restorable (non-GCing) YjsCrdtSet for Crdt types, using the Crdt constructor itself as the valueConstructor. I think this should be possible by declaring e.g.

const CSet = {
    of(...) { ... }
}

in addition the CSet interface.

Originally posted by @mweidner037 in https://github.com/composablesys/compoventuals/issues/102#issuecomment-881013674

mweidner037 commented 1 year ago

Instead, the default implementations get the shortest name (e.g. CSet).