# How to include a backquote in a message?

NB: I know one suboptimal solution to this problem, which I give at the end. I'm looking for a better one. Also, I was not able to solve this problem with the solutions give in Backquote in string template?.

For example, this assignment is no problem:

example::message = "foobar is set to 1"; (* no problem *)


But if one uses this message in a Message expression, then two messages appear, and the second one is malformed:

foobar = 3;
Message[example::message, foobar]

StringForm::sfq: Unmatched backquote in foobar is set to 1. >>
example::message: foobar is set to 1


One solution is to make a slot for the backquote, and include "" among the message parameters:

example::message = "foo1bar is set to 2";
Message[example::message, "", foobar]

example::message: foobar is set to 3


This solution, however, is suboptimal, because it requires users to remember to include the otherwise meaningless "" among the message parameters.

From the StringForm docs use ".":
m::a = "1 . 2";
m::a: a  b

• wonder why StringTemplate doesn't use this convention. – george2079 Mar 14 '17 at 22:05
• @george2079 Message uses StringForm which is just a formatting head. But it's a much more restricted system. In StringTemplate you could match that "." to "."` in your template driver so it introduces ambiguity. – b3m2a1 Mar 14 '17 at 22:07