Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass function metadata to malli.core/-instrument #680

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meditans
Copy link

@meditans meditans commented Mar 31, 2022

This change extends the third arity of malli.core/-instrument so that it
optionally accepts the metadata of the old function. That metadata is
passed downstream to the report function.

This new modality is called in malli.instrument/-strument! so that
when we render we can know the name (and the source file location)
of the offending function.

This change extends the third arity of malli.core/-instrument so that it
optionally accepts the metadata of the old function. That metadata is
passed downstream to the `report` function.

This new modality is called in malli.instrument so that when we render
we can know the name (and the source file location) of the offending
function.
Copy link
Member

@opqdonut opqdonut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also add a test!

@@ -23,7 +23,7 @@
(true? (:gen d)) (dissoc $ :gen)
:else $))]
(alter-meta! v assoc ::original-fn original-fn)
(alter-var-root v (constantly (m/-instrument dgen original-fn)))
(alter-var-root v (constantly (m/-instrument dgen original-fn nil :original-fn-meta (meta v))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed this briefly with @ikitommi and we'd prefer if you passed in :meta (meta v) as part of dgen, the first argument of -instrument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants