this code came from the glycogen project
core forms parse registry
one
generic+’s default case do not work properly DONE
removing the :any typetag should decrease code complexity DONE
extracting default case from regular cases DONE
how to represent a forked spec in the compile time registry ? is an alias is enough ? No we have to clone in order to be hermetic to further changes runtime state has to be cloned to
I could keep all cases, currently I’m using impl.registry/conj-case that is removing some previous cases but it should not be necessary cases should be simply added, each batch of cases should be reversed and prepended to the cases vector OR append batches non reversed and reverse the whole thing for computing extension-class-cases
extend : will only add implementations, no overiding of any sort, most safe (totally safe if no default impl) tune : like extend with the ability to precise some implementations (if :coll implements g, we can extend g to :vec) (can break existing code) patch : like tune with the ability to overide methods entirely (least safe)
extend and tune modes are just doing extra checks over the most permisive mode patch
some generics could disallow extension entirely
***
Since we’ve introduced a runtime state that holds implementations at runtime, we could add some facilities to wrap/upd behavior at the generic or implementation level extract methods to build object on the fly (maybe not possible on JVM)
The expansion-state dynamic variable could go away in favor of fully functional The macro layer should always contains a call to the function that implements the macro, passing it {:env &env :form &form}
I could try to completly wrap defn behavior I mean that if a generic has only default implementations it is just a normal function It can become a generic if extended. This way we enforce the convention of passing the object as first argument to all functions