output_string_with_context

Christopher Rodd SPEIRS crs at students.cs.mu.oz.au
Wed Apr 23 19:04:12 AEST 1997


Hi all,
	Seeing that i am about to have to write a number of predicates
that output error messages, i was thinking of implementing a
'output_string_with_context' predicate.  Before i do, i was wondering 
 - What should the predicate be called
 - Where should the predicate go? (i.e. which module?)
 - What should be the type of its arguments.  Possibilities include:

output_string_with_context(Context, "a really quite verbose error
message that is not going to fit on a single line as it is describing
the error in detail")

would output

myfile:300: a really quite verbose error message that is not going to fit 
myfile:300:   on a single line as it is describing the error in detail

OR

perhaps it should take a list of strings, where each element in the list
is indivisible, but if successive elements will fit on the one line,
then it will be printed on the same line.  

output_string_with_context(Context, ["a really quite verbose error", "a
predicate definition that doesnt want to be split up", "the rest of the
message"]).

myfile:300: a really quite verbose error 
myfile:300:   a pred def that shouldnt be split up the rest of the message

OR 

the predicate could take a list of annotated strings.  eg
output_string_with_context(Context, [yes("a really quite verbose error"), 
no( "a predicate definition that doesnt want to be split up"), 
yes("the rest of the message")]).  

where yes(String) means that the string may be broken up on whitespace,
whereas no(String) means that the string must be kept on a single line
if it is possible, otherwise break it on whitespace.

would output 
myfile:300: a really quite verbose error 
myfile:300:   a pred def that shouldnt be split up the rest of the message

So, what do people think?

Chris



More information about the developers mailing list