[m-users.] How do you go about logging?

Julien Fischer jfischer at opturion.com
Sun Apr 6 21:00:05 AEST 2014


Hi,

On Sun, 6 Apr 2014, Left Right wrote:

> Thanks for reply!
> Would you be so kind as to point me to the docs where I should read on
> what "trailed" means?

It's described in the ``Trailing'' section of the reference manual.
<http://www.mercurylang.org/information/doc-latest/mercury_ref/Trailing.html#Trailing>

Trailing is not relevant here other than the fact mutables are trailed
by default.

> Other then that: do I understand it correctly that "ground" in this
> context means something roughly equivalent to C++ constexpr? I.e.
> something that doesn't require calling functions to be computed.

No, ground here just means that a term has a definite value and doesn't
contain any variables.  In the example being discussed that means that
Factor must have a definite value by the time the call to io.write/3
is made -- that differs from C++ style constexprs where the value would
be required to be known at compile time.

> If so, is there a way for the programmer to promise to the compiler that
> this is the kind of variable it is? And if this is not the way it
> works, then where could I read about this mechanism?

The mode system is discussed in chapter 4 of the reference manual.

> I've so far only red the book.pdf downloadable from the documentation
> section of the site, but I see that it's far from being enough for
> even simple stuff :)

This is covered in chapter 3 of that book.  I think your experience
here may have been a bit misleading, probably due to the fact that
trace goals and mutables are _not_ "simple stuff".  The compiler could
also be a bit clearer about exactly what's wrong here.  (Incidentally,
if you remove the trace goal from the predicate, then the compiler is
quite clear about what's wrong.)

Cheers,
Julien.



More information about the users mailing list