[m-users.] How to determine function provenance?

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Dec 19 11:30:05 AEDT 2018



On Tue, 18 Dec 2018 19:01:20 -0500, Jeffrey Brown <jeffbrown.the at gmail.com> wrote:
> Hi! I'm reading through the Mercury libraries. When I do that in Haskell,
> if I come across a function I don't recognize, there are a few ways to
> determine where it came from. (For instance you can import everything the
> library imports into the REPL and then run "?i foo" to find foo's
> provenance.)
> 
> In Mmercury, if I could be sure that a line of code defines the function
> foo if and only if that line starts with the word foo followed by no blank
> space, then I'll just grep the libraries for "^foo". Does that
> if-and-only-if condition actually hold?

It holds *if* you follow the standard Mercury programming style.

> Is this what y'all do?

No. The Mercury developers use tags files:

https://en.wikipedia.org/wiki/Ctags

The Mercury distribution contains mtags, a tool for building tags files
for Mercury programs. Once you have run e.g. "mtags *.m", then
you can jump to the definition of a type, predicate or function
with a simple command in most editors. For example, when the cursor
is on the start of a name in vim, the command control-] will jump
to the definition of whatever entity it names.

Zoltan.


More information about the users mailing list