-
Notifications
You must be signed in to change notification settings - Fork 10
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
proof of concept for attaching :doc metadata to generate functions #98
base: master
Are you sure you want to change the base?
Conversation
@genmeblog, maybe you can improve on it. |
I removed the duplication of the help logic. BUT its slow. |
Can be used like this:
Help generation is as well memoized, so at least fast on second call |
It does work as well for Calva, not sure why it failed as I tried. |
Maybe instead of
|
Yes, I thought about it. Ideally we could speed it up..., but likely not possible. Not per library. |
Yes, you're right, so maybe an argument to |
FYI: |
In my view the "slow R package loading" due to help loading is acceptable, as it happens only once per R package, then its cached. |
We can also alter vars in the background I think. |
I am pretty happy with it now. The :doc gets now changed to be "help" via alter-meta! in a |
Remark: as we use now a "future" we get the 60 seconds waiting when clojure shuts down |
Strange, futures shouldn't affect the shutdown time... |
Yes, they do. |
Ok. I see. What about add a |
Will not make a difference, as this hook is called "too late as well" , I suppose. |
When does this 60s delay happen? I mean what cases are affected? |
In practice only in units tests...or when running "clj -e ' ' ". |
time clj -e "(require '[clojisr.v1.r :as r])(r/require-r '[utils])"
real 1m10.797s
user 0m29.738s
sys 0m0.844s Here we see the 60 seconds delay. vs time clj -e "(require '[clojisr.v1.r :as r])(r/require-r '[utils])(System/exit 0)"
real 0m14.728s
user 0m29.386s
sys 0m0.827s same duration as: time clj -e "(require '[clojisr.v1.r :as r])(r/require-r '[utils])(shutdown-agents)"
real 0m15.212s
user 0m29.055s
sys 0m0.767s So people doing scripts just need to remember to add it. |
(defn add-to-ns [ns-symbol r-symbol r-object] | ||
(intern ns-symbol | ||
(r-symbol->clj-symbol r-symbol r-object) | ||
r-object)) | ||
r-object) | ||
ns-symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this (ie. returned symbol)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like mistake. Will fix in next commit.
(add-to-ns ns-symbol r-symbol r-object))) | ||
(add-to-ns ns-symbol r-symbol r-object)) | ||
(future | ||
(Thread/sleep 5000) ;; this has the effect that the evaluatin of r-require "returns immidiately" during interactive work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future
runs just after symbols are interned - do we need this 5sec waiting time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it we have a noticeably lag in IDE when interactively evaluating a 'require-r'
This is very draft.
I was not able to re-use the existing "help" , and need a hack to have a session.
And on this I am not sure, how to do better.