beetl 支持 严格的MVC

13 views
Skip to first unread message

atu

unread,
Aug 21, 2011, 10:17:41 PM8/21/11
to antlr中文论坛
有些架构师不喜欢模板语言有太多的功能,尤其是函数调用,算数表达式和复杂的条件表达式等各种属于业务逻辑的部分。
如果你认同此观点,以及论文strictly enforces model-view separation(http://
www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf) 观点,可以设置
BeeTemplate.makeStrict(true);

如下代码:
BeeTemplate t = new BeeTemplate("#:if(!isGirl){var c=1;}");
t.makeStrict(true);
t.set("isGirl", false);
t.getTextAsString() ;

会导致编译错误
STRICK_MVC 位于1行,符号 var
1|#:if(!isGirl){var c=1;}

Reply all
Reply to author
Forward
0 new messages