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

Vars that contain functions that are inlined in clojure.core are safe to deref at analysis time in call position #483

Closed
borkdude opened this issue Dec 21, 2020 · 1 comment

Comments

@borkdude
Copy link
Collaborator

user=> (def inlined (filter (comp :inline meta) (vals (ns-publics 'clojure.core))))
#'user/inlined
user=> (count inlined)
90
user=> (first inlined)
#'clojure.core/+'
@borkdude
Copy link
Collaborator Author

borkdude commented Dec 21, 2020

deref-inlined branch contains one possible implementation. When using the inlined function directly, it is faster with this example:
"(loop [val 0 cnt 1000000] (if (pos? cnt) (recur (inc val) (dec cnt)) val))"

But then we lose error information. If we put that back using with-meta on the function itself, the invocations become slower and this results in losing information for the stacktrace in babashka.

We could mitigate this by adding more info to the call node itself for the error message, while the happy path can continue using the inlined function.

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

No branches or pull requests

1 participant