camsaul / methodical

Functional and flexible multimethods for Clojure. Nondestructive multimethod construction, CLOS-style aux methods and method combinations, partial-default dispatch, easy next-method invocation, helpful debugging tools, and more.
Eclipse Public License 2.0
294 stars 19 forks source link

Support datafying multifns #122

Closed camsaul closed 2 years ago

camsaul commented 2 years ago

Datafying a multimethod will now give you a big dump of useful information like

{:ns           'methodical.datafy-test
 :name         'methodical.datafy-test/mf
 :arglists     '([x y])
 :class        methodical.impl.standard.StandardMultiFn
 :combo        {:class          methodical.impl.combo.threaded.ThreadingMethodCombination
                :threading-type :thread-last}
 :dispatcher   {:class         methodical.impl.dispatcher.multi_default.MultiDefaultDispatcher
                :dispatch-fn   methodical.datafy-test/dispatch-first
                :default-value :default
                :hierarchy     #'clojure.core/global-hierarchy
                :prefs         {:x #{:y}}}
 :method-table {:class   methodical.impl.method_table.standard.StandardMethodTable
                :primary {:default
                          {:ns       'methodical.datafy-test
                           :name     'methodical.datafy-test/mf-primary-method-default
                           :doc      "Here is a docstring."
                           :file     "methodical/datafy_test.clj"
                           :line     15
                           :column   1
                           :arglists '([next-method x y])}}
                :aux     {:before {[:x :default] [{:ns                    'methodical.datafy-test
                                                   :name                  'methodical.datafy-test/mf-before-method-x-default
                                                   :doc                   "Another docstring."
                                                   :file                  "methodical/datafy_test.clj"
                                                   :column                1
                                                   :line                  20
                                                   :arglists              '([_x y])
                                                   :methodical/unique-key 'methodical.datafy-test}]}
                          :around {[:x :y] [{:ns                    'methodical.datafy-test
                                             :name                  'methodical.datafy-test/mf-around-method-x-y
                                             :file                  "methodical/datafy_test.clj"
                                             :column                1
                                             :line                  25
                                             :arglists              '([next-method x y])
                                             :methodical/unique-key 'methodical.datafy-test}]}}}
 :cache        {:class methodical.impl.cache.watching.WatchingCache
                :cache {:class methodical.impl.cache.simple.SimpleCache
                        :cache {}}
                :refs  #{#'clojure.core/global-hierarchy}}}

This will help with #76

codecov[bot] commented 2 years ago

Codecov Report

Base: 87.47% // Head: 86.90% // Decreases project coverage by -0.57% :warning:

Coverage data is based on head (351a147) compared to base (2d5159a). Patch coverage: 78.78% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #122 +/- ## ========================================== - Coverage 87.47% 86.90% -0.58% ========================================== Files 19 21 +2 Lines 1038 1107 +69 Branches 60 63 +3 ========================================== + Hits 908 962 +54 - Misses 70 82 +12 - Partials 60 63 +3 ``` | [Impacted Files](https://codecov.io/gh/camsaul/methodical/pull/122?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul) | Coverage Δ | | |---|---|---| | [src/methodical/impl/method\_table/clojure.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9tZXRob2RfdGFibGUvY2xvanVyZS5jbGo=) | `66.66% <25.00%> (-7.02%)` | :arrow_down: | | [src/methodical/impl/dispatcher/standard.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9kaXNwYXRjaGVyL3N0YW5kYXJkLmNsag==) | `83.00% <28.57%> (-4.37%)` | :arrow_down: | | [src/methodical/impl/combo/clojure.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9jb21iby9jbG9qdXJlLmNsag==) | `81.81% <33.33%> (-8.19%)` | :arrow_down: | | [src/methodical/impl/combo/clos.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9jb21iby9jbG9zLmNsag==) | `60.46% <33.33%> (-1.44%)` | :arrow_down: | | [src/methodical/impl/dispatcher/everything.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9kaXNwYXRjaGVyL2V2ZXJ5dGhpbmcuY2xq) | `58.06% <33.33%> (-6.23%)` | :arrow_down: | | [src/methodical/impl/combo/threaded.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9jb21iby90aHJlYWRlZC5jbGo=) | `96.42% <75.00%> (+0.13%)` | :arrow_up: | | [src/methodical/impl/cache/watching.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9jYWNoZS93YXRjaGluZy5jbGo=) | `89.36% <80.00%> (+0.72%)` | :arrow_up: | | [src/methodical/impl/standard.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9zdGFuZGFyZC5jbGo=) | `86.91% <91.66%> (+0.04%)` | :arrow_up: | | [src/methodical/impl/method\_table/common.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9tZXRob2RfdGFibGUvY29tbW9uLmNsag==) | `92.30% <92.30%> (ø)` | | | [src/methodical/impl/cache/simple.clj](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul#diff-c3JjL21ldGhvZGljYWwvaW1wbC9jYWNoZS9zaW1wbGUuY2xq) | `100.00% <100.00%> (ø)` | | | ... and [6 more](https://codecov.io/gh/camsaul/methodical/pull/122/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Cam+Saul)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.