[m-rev.] for review: fix an XXX: escape characters returned by deconstruct.functor/4

Julien Fischer jfischer at opturion.com
Wed Jun 13 00:49:37 AEST 2018


Hi Zoltan,

On Tue, 12 Jun 2018, Zoltan Somogyi wrote:

> On Fri, 8 Jun 2018 10:05:19 -0400 (EDT), Julien Fischer <jfischer at opturion.com> wrote:
>> Fix an XXX: escape characters returned by deconstruct.functor/4.
>>
>> runtime/mercury_ml_expand_body.h:
>>      Fix an XXX: escape characters in functors.
>
> The output of the deconstruct_arg.m test case still contains unescaped
> characters. This is because we print the value of the whole term under test
> using io.print, which calls stream.string_writer.print, which calls the put
> method, which calls write_char. No predicate in that chain quotes the char.

Actually, I think the correct thing to do is for that test case to call
io.write rather than io.print, since the former** which _will_ add escapes
for character values.  It will also add them for string values which is
something that deconstruct.functor/4 also doesn't currently do (but almost
certainly should).

(** there seems to be another issue here, io.write prints carriage
returns using thier octal escape (\015) rather than just using \r.  The
reference manual lists the latter as a recognised backslash escape, so
it should really use it.)

> It seems to me that if deconstruct.functor quotes these special chars,
> then stream.string_writer.print should too.

I think the current behaviour of print is fine -- in any case, I would
be extremely wary of changing it.

> And changes to both should be mentioned in the NEWS file, since they
> are user-visible changes in behavior.

Shall do.

Julien.


More information about the reviews mailing list