[m-dev.] logging proposal

Ian MacLarty maclarty at cs.mu.OZ.AU
Tue Feb 28 19:37:14 AEDT 2006


On Tue, Feb 28, 2006 at 10:16:11AM +1100, Mark Brown wrote:
> 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).

Would you ever have something else besides an I/O state pair in the
list after the `debug'?  If not then the !IO seems a bit redundant.  I
can't think how having anything else besides !IO would work.

Ian.
--------------------------------------------------------------------------
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