[m-rev.] for review: clean up string.m

Zoltan Somogyi zoltan.somogyi at runbox.com
Sun Nov 9 01:01:01 AEDT 2014


For review by Julien. Can you please have a look at the
XXX I added for the treatment of -0.0, and tell me whether
you know of a way to check the sign bit directly (not via < 0.0
test) on each of our target languages?

I next intend to move the implementation of string.format
to a new submodule of string.m, so that string.m doesn't become
even bigger when I add code for parsing format strings
*without* the values to be printed being present.
The idea is for compiler/format_call.m to use this new capability
to transform *all* calls to string.format and io.format in which
the format string is statically known to a sequence of calls to the
predicates that do the actual formatting, thus compiling away
all the format string interpretation overhead.

This would require turning off using_sprintf, since (a) we cannot
target the innards of a C library function, and (b) having the
interpreted and compiled versions of string.format and io.format
having different behavior is not a good idea.

Besides enabling compiling away format string interpretation
overhead, turning it off would also allow us to add new format
specifiers sprintf *cannot* handle. The obvious one is a specifier
that does what io.write does.

Independently of the above, I plan also to look into factoring out
commonalities in the existing formatting code by replacing the
conversion specifiers d/i/o/x etc, e/f/g etc as just int and float
specifiers with parameters for things such as octal/decimal/hex base.

Any objections?

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.string
Type: application/octet-stream
Size: 1259 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20141109/920dc3d9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.string
Type: application/octet-stream
Size: 71432 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20141109/920dc3d9/attachment-0001.obj>


More information about the reviews mailing list