-
Notifications
You must be signed in to change notification settings - Fork 113
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
#info directive #294
base: master
Are you sure you want to change the base?
#info directive #294
Conversation
The lazy-evaluation feature causes LibIndex module of ocp-index to hang if the Env.t of the Toploop changes. We can't #require or #load other libraryies. To workaround it, we fork a clean room for ocp-index.
I have to say that as an English speaker I find "#infoof" amazingly hard to read. (I also wouldn't guess what it does from the name, the first parse that comes to mind is "in foof" and that's pretty incomprehensible...) |
Yeah this isn't a great name. #info is fine; #doc is fine; #info_of could work. |
I'd say "#info" or "#doc". |
Ha, at the first glance. I feel that the name is very funny. foof ʕoٹoʔ ʕ•̀ω•́ʔ |
I think #info is fine. |
I've renamed the pull request btw. |
That's a nice feature :) BTW, I would make the dependency on ocp-index be a required one rather than an optional one. Optional dependencies always end up being annoying in the long run. |
The implementation of ocp-index seems not stable for now(we have to fork a clean room for it). I'd like to keep it as an optional dependency to observe for a period of time. When everything is stable enough, we then make it as a required dependency. Is this ok? |
I have no opinion on the optional vs. required dependency issue. How do we decide when this is okay to merge? |
@diml I've seen negative opinions about optional dependencies, but what is the main objection against them? |
@kandu that seems reasonable yeah. @pmetzger I'd suggest that someone test it on its machine, just to make sure nothing obvious was missed, and eyeball the code to make sure things seem reasonable. For instance that no unwanted dependency was added by accident or a rootkit was slipped in (just joking here, though we should definitely do it for new contributors). Then I'd say it's good to merge. This looks like a feature that is worth having. @bluddy the main source of pain is recompilation. When you install a new package, you have to recompile all already installed packages that have a depopts on this package plus all their reverse dependencies. For utop I guess it's probably not too bad as it doesn't have many reverse dependencies. But in this case there is also something else: whenever you setup a new switch, you now have to remember to install both utop and ocp-index if you want all the features of utop. |
It seems to me that requiring ocp-index as mandatory has only one defect, which is that sometimes it is broken when a new release comes out. |
yeah, considering about this, to keep it as an optional dependency is a good option since what you've just said implies we are confident that zed, lambda-term and utop will keep the pace with new ocaml releases better than ocp-index will do :) And once that happens, utop will be still installable without the presenting of #info directive temporarily. |
This feature is disabled on Windows since By the way, are there any easy expressions in dune which I can use to define required libraries more flexibly? like: (libraries
((and (= %{os_type} Unix) (= (system "opam var ocp-index:installed") "true"))
ocp-index)) Only requires ocp-index as dependency when we are on Unix and ocp-index is installed. |
@kandu Good question. I don't know. Perhaps you should ask the Dune maintainers? |
Not really, though there is a ticket about this. What about using spawn? It's a portable and more efficient way of spawning sub-processes. Note that it's under the janestreet org, however it is developed on github as a normal open source project, so you can expect the API to be stable. |
There are two ways to use ocp-index.
I think the second way is preferable, ocp-index developers will eventually fix the bug and we will not need to fork a clean room for it and thus it will work on all OSes. The lack of Windows support is temporary. |
Hi, @AltGr @Drup |
I see. Personally, I would recommend to fix ocp-index first. It means that we have to wait before making this feature available to users, but on the other hand when we release it both utop and ocp-index will be in a better state. |
Wow, this looks great, thanks! @kandu, if you could open an issue as you proposed, that'd be very helpful and I'll look into it. :) |
Ah, thanks! here is the issue report OCamlPro/ocp-index#136 |
Great feature! Method 2 is clearly preferable, and libindex should be fairly easy to use. Let's try to beat ocp-index into shape so that everything works fine :p |
btw, why not show the doc information in the suggestion bar on the bottom? This is what bpython does for example. |
BTW, I note this has been stalled out for a long time. What do we need to do to get it moving? |
@pmetzger I guess someone has to fix OCamlPro/ocp-index#136 |
What do we need to do to get this merged? |
I'm not familiar with the implementation of this PR, but if it just adds a new directive, I don't think it has to be maintained as part as utop. It can be implemented as something that when |
Up to @kandu. |
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.
Is a new dependency needed for this? Doesn't utop have access to the docstrings of various items like it has access to their type signatures?
I note that this is still hanging around; @kandu you should finish it. |
This PR adds a depopt, ocp-index to utop. If utop is built when ocp-index is installed, a new directive,
#infoof
, will present.This directive works similarly to
#typeof
. The symbol resolving and completion mechanism is based on the current Env of the Toploop. That is, if we typeopen String;;
in utop,#infoof "concat"
will still find out the very infomation ofString.concat
Click to expand