[m-dev.] logging proposal

Ralph Becket rafe at cs.mu.OZ.AU
Thu Mar 2 09:25:42 AEDT 2006


Ian MacLarty, Wednesday,  1 March 2006:
> 
> I would argue for using a higher-order term.  Anything complex should 
> probably be defined in another predicate anyway (you don't want your 
> predicate bodies littered with long debug goals).
> 
> The thing that bothers me about the 'debug [!IO] (...)' syntax is that 
> there are always only two variables in the square brackets and square 
> brackets are normally used for arbitrary length lists.  Perhaps it 
> should be 'debug {!IO} (...)'?
> 
> I favor the ho term approach, but I don't feel strongly about it.

I think the HO approach is a pretty awful idea.  Compare

	debug [!IO] (
		io.see("logfile", _, !IO),
		io.print("logmessage", !IO),
		io.seen(!IO)
	)

with

	debug (
		pred(IO0::di, IO::uo) is det :-
			some [!MyIO] (
				!:MyIO = IO0,
				io.see("logfile", _, !MyIO),
				io.print("logmessage", !MyIO),
				io.seen(!MyIO),
				IO = !.MyIO
			)
	)

I hear what you're saying, but I think Mark's suggestion is a good
compromise.  After all, this is intended for debugging work and if
you make it awkward to use, people will just use the unsafe module
and compile without optimisation to prevent unsafe.print etc. from
being optimised away.

-- Ralph
--------------------------------------------------------------------------
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