Closed lachlanmcdonald closed 6 years ago
Can templates be called prior to declaration
IMO, templates are effectively compiled into functions. most languages (java, javascript, c, c++) allow to call functions or methods out-of-order. also, the wording of the spec supports this. however, practically, it is nicer code if you declare the templates before they are used.
Can templates be referred to by a string
yes. by any expression.
Output of template identifier?
how about the name of the template? so just foo
in your example ?
Excellent, thanks @tripodsan .
Does this mean that we'd expect:
<template data-sly-template.foo>foo</template>
${foo == 'foo'}
To evaluate as true
?
Hi,
I have a few questions regarding edge-cases for
data-sly-template
that I was hoping to have clarified:Can templates be called prior to declaration
Would the following render
bar
or throw an error?The spec states:
Which I assume also means that the template function is global?
If templates are global, would the following return
bar
,xyz
or throw an error?Can templates be referred to by a string
Would the following return
foo
or throw an error?Output of template identifier?
What is output by
${foo}
in the snippet below?