Skip to content

Add Str\format, and support custom error messages to C\onlyx

Compare
Choose a tag to compare
@fredemmott fredemmott released this 16 Mar 17:45

Str\format is similar to sprintf, however it takes a Str\SprintfFormatString, which is somewhat stricter than the format specifier for sprintf. For example, %d requires an integer when using Str\format, however sprintf() is defined as accepting mixed in Hack, and in practice is happy to accept floats.

Str\SprintfFormatString is not stable: our goal is for this to be extremely strict about matching format string placeholder types against parameter types - we may make type restrictions narrower in the future.

C\onlyx now optionally takes a Str\SprintfFormatString argument and additional arguments for the placeholders.