composablesys / collabs

Collabs library monorepo

Home Page:https://collabs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"of" methods on interfaces, for default implementations

mweidner037 opened this issue · comments

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 #102 (comment)

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