mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
library/string.builder.m:
Add the predicate string.builder.format. We already have
string.writer.format, one of whose instances, the one for
string.builder.{handle,state}, does a string.format and adds
the resulting string to the given string builder. The new predicate
allows this to be done directly, without the type class overhead
(both conceptual overhead, and compilation time overhead) in cases
where the generality of type class is not needed, and in a way that
allows format strings in direct calls to string.builder.format
to be parsed and interpreted at compile-time, the same way as we
already do for calls to e.g. io.format.
NEWS.md:
Announce the new predicate.
compiler/format_call.m:
Specialize calls to string.builder.format. Use the code that specializes
calls to io.format, after suitable generalization.
compiler/builtin_lib_types.m:
mdbcomp/builtin_modules.m:
Add convenience functions needed by new code in format_call.m.
compiler/get_dependencies.m:
In the presence of (potential) calls to string.builder.format,
implicitly import the modules that define the predicates that
format_call.m may now generate calls to.
compiler/introduced_call_table.m:
List string.builder.append_string as a predicate that format_call.m
may now introduce calls to.
tests/hard_coded/test_builder_format.{m,exp}:
A new test case to test the new functionality.
tests/hard_coded/Mmakefile:
Enable the new test case.
tests/warnings/format_call_warning.m:
Fix indentation.
2 lines
21 B
Plaintext
2 lines
21 B
Plaintext
42_abc_55.500000_def
|