FreeMarker准备在2.4版中加入新的指令#template, 用于上下文隔离包含模板. 与原有的#include相对应, #include为上下文内包含(内嵌)模板.
然而, 大家对这一新指令的命名都极不赞同.
首先template是一个名词, 不适合用于包含这样一个动作性指令名.
[quote="Attila Szegedi 回复的邮件"]Sorry for nitpicking, but shouldn't such a directive rather be a verb?
I.e. #load, #render, #execute come to mind. Using a noun (#template) sounds as if you're defining something (see: #macro, #function, etc.).[/quote]
中间引出大量回复, 给出了n多方案, 如:
#subtemplate, #safeinclude, #load, #exec, #render, #do. #process, #merge, #embed
赞同较多的是: #render, #process, #embed
但render(渲染)与图形学上的概念混淆, 表意不清.
process(处理)太过泛化, 这个词感觉什么地方都可用.
embed(嵌入)是比较合理的. 但似乎应该与现有的include指令名换一个才恰当. 因为embed才表示在当前上下文执行, include表示包含内容(在不同上下文执行).
[quote="Daniel Dekany 回复的邮件"]Should I replace all application of #include with #embed in the 2.4 Manual? #include was one of the first few directives introduced (in the Getting Started chapter). I suppose now we should propagate #embed instead. Also I wonder if #include should be deprecated in 2.4.[/quote]
最后结论还没出来, 但对CommonTemplate([url]http://commontemplate.org[/url])的设计很有借鉴意义, 现在CommonTemplate采用inline(内联)表示同上下文包含, include(包含)表示上下文隔离包含, 似乎将inline改成embed会更合理些, 可能会在下一版本进行变更.
然而, 大家对这一新指令的命名都极不赞同.
首先template是一个名词, 不适合用于包含这样一个动作性指令名.
[quote="Attila Szegedi 回复的邮件"]Sorry for nitpicking, but shouldn't such a directive rather be a verb?
I.e. #load, #render, #execute come to mind. Using a noun (#template) sounds as if you're defining something (see: #macro, #function, etc.).[/quote]
中间引出大量回复, 给出了n多方案, 如:
#subtemplate, #safeinclude, #load, #exec, #render, #do. #process, #merge, #embed
赞同较多的是: #render, #process, #embed
但render(渲染)与图形学上的概念混淆, 表意不清.
process(处理)太过泛化, 这个词感觉什么地方都可用.
embed(嵌入)是比较合理的. 但似乎应该与现有的include指令名换一个才恰当. 因为embed才表示在当前上下文执行, include表示包含内容(在不同上下文执行).
[quote="Daniel Dekany 回复的邮件"]Should I replace all application of #include with #embed in the 2.4 Manual? #include was one of the first few directives introduced (in the Getting Started chapter). I suppose now we should propagate #embed instead. Also I wonder if #include should be deprecated in 2.4.[/quote]
最后结论还没出来, 但对CommonTemplate([url]http://commontemplate.org[/url])的设计很有借鉴意义, 现在CommonTemplate采用inline(内联)表示同上下文包含, include(包含)表示上下文隔离包含, 似乎将inline改成embed会更合理些, 可能会在下一版本进行变更.