|Anonymous | Login | Signup for a new account||2017-05-29 19:15 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005377||OCaml||~DO NOT USE (was: OCaml general)||public||2011-10-17 16:16||2015-12-11 19:26|
|Target Version||Fixed in Version||4.02.0+dev|
|Summary||0005377: toplevel should provide an option to limit recursion when printing nested modules|
|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|
# #use "topfind";;
- : unit = ()
# #require "camomile";;
/usr/local/lib/ocaml/3.11.2/camomile: added to search path
# include CamomileLibraryDefault;;
[0001276:0001000 lines of output]
|Attached Files|| show_types2.diff [^] (9,461 bytes) 2011-12-15 11:29 [Show Content]
show_types.diff [^] (14,574 bytes) 2013-07-31 09:35 [Show Content]
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)
edited on: 2011-10-24 12:05
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.
OK, it seems that I misunderstood what you wanted.
Indeed, there is no support for exploring modules in the toplevel,
other than printing the full signature by aliasing a module.
However, a pragma for changing the logical print depth of
modules seems a rather hacky way to go; one would rather
use a real cli library browser...
This might be nice if we can find a minimal language to do that.
#show value <path>
#show type <path>
#show module <path> [<depth>]
#show module type <path> [<depth>]
#search value "<regexp>"
Note that there are also GUI tools to do that, like ocamlbrowser
(which works with just .cmi), or ocamldoc.
By the way, at least for me trunk compiles perfectly.
But don't forget 'make clean' before you start.
I definitely like the #show pragma :)
Exploring with external tools is fine, but an ability to do this directly from toplevel, in ad-hoc manner, is invaluable.
PS I did check the build failure with clean svn checkout
A simple patch is now available in trunk/experimental/garrigue/show_types.diffs
It defines directives
There is no depth option at this point (they all only take a path).
Concerning the depth, printing uses the standard formatter, so you can just do
Format.set_max_boxes 6 to get only in the immediate contents of a module.
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).
I updated show_types.diff, based on show_types2.diff
Sorry for the long delay.
It looks like a good addition.
|I think we should probably merge this `#show` directive in 4.02, since module aliases remove the usual method people use for exploring APIs (i.e. `module F = Foo` to print the contents of `Foo`).|
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)?
|I've committed to trunk (rev 14616) a change corresponding to my previous note.|
edited on: 2014-04-17 11:27
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.
|Note that the original request (bounding the depth of the printed result) is not addressed yet.|
> Note that the original request (bounding the depth of the printed result) is not addressed yet.
It is: when using #show on modules, you only get one level (for modules).
See for instance the difference between #show module Hashtbl and #show module Hashtbl.Make.
A further question is whether it would not be better to also omit module types, since they can be quite long too.
|Ah yes, sorry.|
|Marking this as resolved. If anyone wants to discuss improvements to #show, please open a new ticket.|
|2011-10-17 16:16||ygrek||New Issue|
|2011-10-24 01:06||garrigue||Note Added: 0006176|
|2011-10-24 01:06||garrigue||Status||new => resolved|
|2011-10-24 01:06||garrigue||Fixed in Version||=> 3.13.0+dev|
|2011-10-24 01:06||garrigue||Resolution||open => fixed|
|2011-10-24 01:06||garrigue||Assigned To||=> garrigue|
|2011-10-24 12:04||ygrek||Note Added: 0006178|
|2011-10-24 12:04||ygrek||Status||resolved => feedback|
|2011-10-24 12:04||ygrek||Resolution||fixed => reopened|
|2011-10-24 12:05||ygrek||Note Edited: 0006178|
|2011-10-25 03:42||garrigue||Note Added: 0006180|
|2011-10-25 09:40||ygrek||Note Added: 0006182|
|2011-12-15 09:17||garrigue||Note Added: 0006300|
|2011-12-15 09:17||garrigue||Status||feedback => acknowledged|
|2011-12-15 09:22||garrigue||Note Added: 0006301|
|2011-12-15 11:27||ygrek||Note Added: 0006310|
|2011-12-15 11:29||ygrek||File Added: show_types2.diff|
|2011-12-16 07:01||garrigue||Relationship added||related to 0005430|
|2013-07-31 09:14||garrigue||File Added: show_types.diff|
|2013-07-31 09:15||garrigue||Note Added: 0010038|
|2013-07-31 09:35||garrigue||File Deleted: show_types.diff|
|2013-07-31 09:35||garrigue||File Added: show_types.diff|
|2013-10-09 14:37||doligez||Tag Attached: patch|
|2014-04-11 13:38||lpw25||Note Added: 0011260|
|2014-04-14 18:36||frisch||Note Added: 0011274|
|2014-04-16 18:53||frisch||Note Added: 0011292|
|2014-04-17 11:26||frisch||Note Added: 0011297|
|2014-04-17 11:27||frisch||Note Edited: 0011297||View Revisions|
|2014-04-17 11:29||frisch||Note Added: 0011298|
|2014-04-17 11:52||garrigue||Note Added: 0011300|
|2014-04-17 13:04||frisch||Note Added: 0011302|
|2014-04-17 17:54||frisch||Note Added: 0011303|
|2014-04-17 17:54||frisch||Status||acknowledged => resolved|
|2014-04-17 17:54||frisch||Fixed in Version||3.13.0+dev => 4.02.0+dev|
|2014-04-17 17:54||frisch||Resolution||reopened => fixed|
|2015-12-11 19:26||xleroy||Status||resolved => closed|
|2017-02-23 16:36||doligez||Category||OCaml general => -OCaml general|
|2017-03-03 17:55||doligez||Category||-OCaml general => -(deprecated) general|
|2017-03-03 18:01||doligez||Category||-(deprecated) general => ~deprecated (was: OCaml general)|
|2017-03-06 17:04||doligez||Category||~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)|
|Copyright © 2000 - 2011 MantisBT Group|