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
toplevel should provide an option to limit recursion when printing nested modules #5377
Comments
Comment author: @garrigue You were lucky: I have reports of messages of more than 1MB... This is now fixed in trunk: long traces are omitted, replaced by logical and physical locations for the error. (commits 11225-11230) |
Comment author: @ygrek The patch affects printing of error locations, but I am talking here about toplevel's normal way to display the contents of module. Sorry, if I am mistaken - current trunk doesn't build - http://build.ygrek.org.ua/jenkins/job/ocaml/label=master/66/console - so I can't verify it. |
Comment author: @garrigue OK, it seems that I misunderstood what you wanted. Note that there are also GUI tools to do that, like ocamlbrowser By the way, at least for me trunk compiles perfectly. |
Comment author: @ygrek I definitely like the #show pragma :) PS I did check the build failure with clean svn checkout |
Comment author: @garrigue A simple patch is now available in trunk/experimental/garrigue/show_types.diffs #show_value There is no depth option at this point (they all only take a path). |
Comment author: @garrigue Concerning the depth, printing uses the standard formatter, so you can just do |
Comment author: @ygrek Here is an updated patch that sticks to single #show directive. Thanks for the trick with Format - it helps, but is not a proper solution - e.g. it works for CamomileLibrary (this module consists of only other modules) but not for say CamomileLibrary.UChar (types are not displayed). |
Comment author: @garrigue I updated show_types.diff, based on show_types2.diff |
Comment author: @lpw25 I think we should probably merge this |
Comment author: @alainfrisch The patch seems very useful to me as well (actually I was just in the middle of writing an email to complain about our broken "module F = Foo" idiom in the toplevel -- call me old school -- when I remembered about this ticket). I'm a bit concerned by the implementation which extends the parsetree with a quite ad hoc construction. Wouldn't it work to change Ptop_dir's argument from directive_argument to "directive_argument list" (and remove Pdir_none)? |
Comment author: @alainfrisch I've committed to trunk (rev 14616) a change corresponding to my previous note. |
Comment author: @alainfrisch I've further extended the notion of directive arguments in commit 14617 to allow keywords and capitalized longidents. Commit 14618 adds the "#show" directive, mostly following the show_types2.diff patch. Given the flexible syntax for directive arguments, it would be simple to give a meaning to "#show bla" (either equivalent to "#show val bla" or showing all components of name bla). Opinions? It's also possible to add support for showing constructors and labels, for instance. |
Comment author: @alainfrisch Note that the original request (bounding the depth of the printed result) is not addressed yet. |
Comment author: @garrigue
It is: when using #show on modules, you only get one level (for modules). |
Comment author: @alainfrisch Ah yes, sorry. |
Comment author: @alainfrisch Marking this as resolved. If anyone wants to discuss improvements to #show, please open a new ticket. |
Original bug ID: 5377
Reporter: @ygrek
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:26:36Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.11.2
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Related to: #5430
Monitored by: @lpw25 @ygrek
Bug description
This would make exploring libraries from toplevel much easier. For each package one can get the list of modules (with findlib), but the only way to explore modules is to include them (or alias) - and for big libraries this can produce lots and lots of output, while one usually wants to see only the first level and explore deeper as needed. This should probably be a directive similar to #print_depth
Example:
#use "topfind";;
#require "camomile";;
/usr/lib/ocaml/unix.cma: loaded
/usr/lib/ocaml/bigarray.cma: loaded
/usr/local/lib/ocaml/3.11.2/camomile: added to search path
/usr/local/lib/ocaml/3.11.2/camomile/camomile.cma: loaded
include CamomileLibraryDefault;;
[~1000 lines of output]
File attachments
The text was updated successfully, but these errors were encountered: