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

Allow instrumenting external functions #841

Merged
merged 2 commits into from
Feb 21, 2023

Conversation

NoahTheDuke
Copy link
Contributor

@NoahTheDuke NoahTheDuke commented Feb 3, 2023

Here's a currently broken attempt at fixing #840. I don't know enough about cljs to know how to solve it, but for clj it works well enough.

I should note that in clj, it doesn't work for any function that is "inlined". So, if you say (m/=> clojure.core/inc [:=> [:cat :int] :int]), calling (inc "1") won't be instrumented as it's compiled to a raw Numbers.inc("1") call. However, writing (#'inc "1") will be instrumented as it will be compiled into const__0.invoke("i").

I think that if this is noted in the docs it's an acceptable trade-off.

Closes #840

@ikitommi
Copy link
Member

Looks good and a change most welcome, thanks!

@ikitommi ikitommi merged commit 8f35221 into metosin:master Feb 21, 2023
@NoahTheDuke NoahTheDuke deleted the nb/instrument-external-functions branch February 21, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Instrumenting external functions
3 participants