Re: print/1 and quoted writing
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 12/20/2013 11:27 PM, Michael Hendricks wrote: > Hi Jan, > > On Sat, Dec 14, 2013 at 11:05 AM, Jan Wielemaker <[email protected] > <mailto:[email protected]>> wrote: > > The predicate print/1 is typically used for printing (debug) messages. > That leads to nasty error messages like this: > > 1 ?- number_codes('1', X). > ERROR: Type error: `number' expected, found `1' > > > I ran into this problem during development today. What if the error > message concluded with the native type of the "found" value. Like this: > > ERROR: Type error: `number' expected, found `1' (an atom) > > I realize this doesn't address the larger issue of portray + quoted, but > it would have clearly resolved the ambiguity in my work today. In itself, it would be a good idea to give some additional information about type errors. I'll have a look at that. The above is clearly better than just '1'. Still, quoted AND the annotation would be really nice ... If it confuses experienced users, it surely confuses beginners. So the question remains: - change print/1 to become printed OR - add printq/1 and some format character for it (or use the : modifier for ~p).