7
$\begingroup$

Bug introduced in V11.0.0 and fixed in V11.2

[CASE:3821295]


It seems that in v11+ arguments are not injected into held StringTemplate, in contrary to how it behaved earlier.

In 10.4

ReleaseHold @ TemplateApply[
  Hold @ StringTemplate["``"],
  {"test"}
]
"test"

in 11.0.1

TemplateObject[{TemplateSlot[1]}, InsertionFunction -> TextString, 
  CombinerFunction -> StringJoin
] 
  (*this is what StringTemplate["``"] evaluates to*)

Documentation does not contain any notes about updates so I consider it a bug. The more that ReleaseHold@TemplateApply[Hold@TemplateSlot[1], {"test"}] works well (that is documented).

$\endgroup$

1 Answer 1

5
$\begingroup$

Regardeless whether it is a bug I need an old behavior for compatibility reasons. My fix is to inject evalauted StringTemplate because TemplateObject will be handled correctly.

ReleaseHold @ TemplateApply[
  Hold @ StringTemplate["``"] /. s_StringTemplate :> RuleCondition[s],
  {"test"}
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.