[m-dev.] logging proposal
Mark Brown
mark at cs.mu.OZ.AU
Tue Feb 28 10:16:11 AEDT 2006
On 28-Feb-2006, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> On Tue, Feb 28, 2006 at 01:06:16AM +1100, Mark Brown wrote:
> > On 27-Feb-2006, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> > > (where they write their output could be given by another mmc option).
> >
> > There could be lots of different kinds of information you may want to
> > communicate to this subsystem, and we won't be able to anticipate all of
> > it. You also might prefer to specify the output location at run-time
> > rather than compile time. Hence I think it would be better to communicate
> > via environment variables.
> >
> > Furthermore, an application may link to two different libraries that use
> > this feature and you might therefore want to send the logs to separate
> > places, but you couldn't do that with either a compile-time or a run-time
> > option.
> >
>
> So are you saying if you make the argument an I/O closure then you can
> implement your debugger to behave however you want? If so then I agree
> with you.
That's pretty much it.
> > > Also it would be
> > > better that user's could add a logging mechanism to their code without
> > > tricking and/or lying to the compiler.
> >
> > Oho, I'm afraid this technique is still very much stretching the truth.
>
> Your right :-)
> We should aim to seperate out the code that defines the behaviour
> of the application, and the code that is for observing/debugging the
> execution of the program. This proposal doesn't quite get there.
>
> Perhaps a better solution would be to have a `log' (or `debug')
> "goal", so in your code you might have a something like:
>
> debug io.format("X = %i\n", [i(X)])
>
> This makes the distinction much clearer.
That's a great idea. I think it would be better to explicitly introduce
the io.state variables though:
debug [!IO] ( io.format("X = %i\n", [i(X)], !IO), ... )
so that `debug' is a new quantifier. This would save using explicit
lambda quantifiers or DCG goals (I can't tell from your sample which
you intended).
>
> > You can backtrack over this tracing code, remember, but the side effects
> > are obviously not undone and the compiler is in no way informed of this
> > fact. This is definitely still an experts only feature, IMHO.
> >
>
> I would think this behaviour would be designed, since the logging would
> be for observing exactly what your program is doing.
That's how _we_ plan to use it. Who knows what users in general will try
to make it do. ;-)
Cheers,
Mark.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list