[m-dev.] logging proposal
Ian MacLarty
maclarty at cs.mu.OZ.AU
Thu Mar 2 10:59:44 AEDT 2006
On 1 Mar 2006, at 23:25, Ralph Becket wrote:
> 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
> )
> )
>
Well I would put that in a separate predicate and use currying :-)
> 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.
>
Okay. As I said I have no strong feelings on the syntax (as long as it
doesn't look like a regular predicate call).
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