lucywang000 / clj-statecharts

State Machine and StateCharts for Clojure(Script)
https://lucywang000.github.io/clj-statecharts/
Eclipse Public License 1.0
229 stars 15 forks source link

Docstrings not available on the public vars #5

Open dpetranek opened 3 years ago

dpetranek commented 3 years ago

I noticed when looking at the implementation of assign that there was a nice docstring for it, but that it gets lost when re-def-ed in statecharts.core. Even for the functions without docstrings my editor provides a nice arglist hint that is pretty useful, which is missing for the statecharts.core vars.

I'm not sure if there's a way to automatically assign the docstrings to another var, but you can do it manually like this:

(def assign ^{:doc "Wrap a function into a context assignment function." :arglists '([f])} impl/assign)
lucywang000 commented 3 years ago

Thanks, it is ofc good to have the docs exported.

For clj i think we can use maros to extract the doc from metadata of the var, but for cljs i'm not sure if there is any good way.

Maybe we just need to manually add the docs and arglist like your example.

mjmeintjes commented 2 years ago

You can have a look at this code (for cljc support) in conjunction with potemkin. It allows you to import functions into a separate namespace and also pulls in the arglist and doc metadata.