diml/utop — pull request #39 by trefis (2013-10-16 08:40:29+00:00)
Title: extend typeof directive

Hi!

Here is a small patch to extend the `#typeof` directive to every construction and not just types.

There are two things to comment here :

1. The directive now accepts strings instead of longidents. That means that we don't have completion anymore, but on the other end we can ask for the type of modules (which I find particularly useful), constructors and exceptions. That could be improved if the directive was pushed upstream, then we could extend the parsing rules for directives a bit.
2. The order in which we look for things in the environment is important since there might be conflict, e.g. "ref" is both a value name and a type name, "Foo" can be both a constructor name or a module name. I made arbitrary choices here : modules before constructors, types before values. If that doesn't suit people it can always be changed, or we could introduce more specific directives.