Fancy tools support!

Luke Gorrie luke@REDACTED
Tue Nov 4 21:24:29 CET 2003


Allo allo,

I have some late items for the "Erlang wishlist" survey from the other
month or year. I'd like some new and exciting runtime features for
doing helpful things in development tools like Distel. Some of this
might already exist without my knowing it - I'm looking for feedback.

In particular:

  Cross referencing, e.g.
    %% who_calls(Module, Function, Arity) -> [{M,F,A}]
    %% List all the known callers of Module:Function/Arity.
  Simple enough - of course it can't be perfect what with 'apply', but
  it can still be much better and more convenient than 'grep'. It's
  very nice to get hyperlinks to all callers of a function at the
  touch of a key in Emacs. (I think Thomas Lindgren has a parse
  transform for adding this to module_info? Jungerl it?)

  Online function documentation (like Lisp "docstrings").
  I would like to do this:
    1> code:apropos("sort", lists).
    [{lists,sort,1},
     {lists,sort,2},
     {lists,usort,1},
     {lists,keysort,2},
     {lists,ukeysort,2}]
    2> code:doc(lists, keysort, 2).
    "keysort(Index, List) -> [SortedList]
    Sort a list of tuples by comparing the Index'th elements."
  This way we can have good online documentation in Emacs, just like
  it has for Emacs Lisp. It requires some `edoc' or `fdoc' like way to
  attach documentation to functions such that it ends up in
  e.g. module_info/0.

  Argument list summaries.
  When I type the '(' in "lists:sort(", I want to see a message
  reminding me of the arguments I can use, like this:
    lists:sort(List)
    lists:sort(Fun, List)
  This is probably hard with multiple clauses and general pattern
  matching, but probably a reasonable arglist approximation could be
  generated from a function's parse tree. If that's realistic, I'd
  like to be able to grab the parse tree and do this at runtime. (Can
  I already get this from modules compiled with +debug_info somehow?)

  Debugging without an interpreter ("always available").
  Only fuzzy ideas, but I've seen debug-related BIFs and always
  wondered what they do and how one might use them?

  Tracing of function calls, message sends, etc.
  This is an exception - I gather the runtime support is already
  great, I just haven't figured out how to use it. Can someone think
  of some nice high-level (Emacs) interface for tracing?

I think in the end it's absolutely essential that this stuff is always
available, without having to run batch-mode programs, recompile with
new flags, or add parse_transform annotations. Otherwise it's just too
hard to get into the habbit of using it (for me at least).

Meanwhile, if people have nice parse-transforms for this stuff, it
could be nice to make the Jungerl use them by default and hack support
into Distel as a testbed. Maybe we can hatch some schemes at EUC.

P.S., the apropos feature could be really good! I learned about
lists:usort/1 while faking up its output -- the number of times I've
written that function badly myself while it was right there.....

P.P.S., I can't find the 'xref' manual in the R9C docs, did that
disappear or am I just overlooking it?

Cheers,
Luke




More information about the erlang-questions mailing list