Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milestone1的讨论 #2

Closed
13leaf opened this issue Mar 7, 2015 · 6 comments
Closed

Milestone1的讨论 #2

13leaf opened this issue Mar 7, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@13leaf
Copy link
Contributor

13leaf commented Mar 7, 2015

  1. Etag中对+操作符的编译结果是否考虑覆盖php默认+的实现?
    例如{{a+b}}转换到etag_add(a,b)而不是((a)+(b))。好处是可以直接实现ab为字符串时的连接行为,无需增加新的字符串concat符。(在其它模板引擎中使用~来做字符串连接)。覆盖的问题会增加函数开销,导致解释结果的性能下降。
  2. Etag转换过程中使用的一些内置函数(原属api)Runtime怎么安置?
    例如1中的etag_add,是否直接在Runtime实现并作为一个全局函数?

下面是参考其它模板引擎的一些比较有趣的feature,看看是否有必要在后续考虑引入:

jade为代表的依靠缩写表达式来节约html的冗余性。以slim举例:

body
  p
    |
      This is a test of the text block.

结果将是

<body><p>This is a test of the text block.</p></body>

list作用域

类似Handlebars可以这样使用.
{{#list people}}{{firstName}} {{lastName}}{{/list}}
等同于{{people.firstName}} {{people.lastName}}

View的数据绑定与共享传递

laravel中可以对View绑定数据提供者,以此实现MVC。还可以让视图之间做数据传递(可以解决之前专题组件的联动更新问题?)。

@13leaf 13leaf added the discuss label Mar 7, 2015
@13leaf 13leaf added this to the M1 milestone Mar 7, 2015
@bigbigant
Copy link
Member

必要的函数应该是在Runtime下实现,但应该是带着namespace的, 类似 Etag\Runtime\op_add。
也可以实现为Etag\Runtime\Op::add()

用+替代~, 从兼容旧版的角度来看,不建议进行。

list作用域 这个觉得不错。

缩写表达式来简化 HTML标签 和 View数据绑定还没看,了解中:)

@bigbigant
Copy link
Member

支持宏不错
多终端 适配
I18n也不错

@13leaf
Copy link
Contributor Author

13leaf commented Mar 11, 2015

支持宏是什么呀?
多终端适配和i18n的具体方案是?

@bigbigant
Copy link
Member

Macro looks like follows.

{#to define#}
{{define SayHello}}
  Hello {{$target}}!
{{/define}}

{#to use#}
{{do SayHello target="World"}}

{#outputs "Hello World!" #}

I've no idea about the schema of i18n now, Lol

@13leaf
Copy link
Contributor Author

13leaf commented Mar 11, 2015

明白了。这个在twig里面用这种形式:

{%macro SayHello(target)%}
    {{"Hello"~target}}
{%endmacro%}

其实和sass中@mixin属同样概念

@bigbigant
Copy link
Member

了解

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants