Closed jamesaspence closed 1 year ago
IIRC, this behavior was specified because it's not possible for the called lambda to know what the current delimiters are, and using contextual delimiters limits how broadly the lambda can be reused.
const variable = 'value';
function lambda() {
return "@{variable}@";
}
{{= @{ }@ =}}
This interpolates properly: @{lambda}@
{{= $ $ =}}
This does not: $lambda$
const variable = 'value';
function lambda() {
return "{{variable}}";
}
{{= @{ }@ =}}
This interpolates properly: @{lambda}@
{{= $ $ =}}
So does this: $lambda$
Closing this as the question seems to have been adequately answered. Please feel welcome to comment anyway.
As per https://github.com/mustache/spec/blob/master/specs/~lambdas.yml#L44, lambdas should use default delimiters when parsing return values. This ends up feeling very inconsistent - assume for example that we are passing a function like
@{#myfunc}@@{otherVar}@@{/myfunc}@
, we would need to change the inner section to{{otherVar}}
to have it interpolate correctly.