You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Daniel Dekany (JIRA)" <ji...@apache.org> on 2017/08/11 11:38:01 UTC

[jira] [Comment Edited] (FREEMARKER-69) Chinese:自定义Directive与Variable变量名称一致导致FTL解析BUG,English:A bug when The user-defined directive key same as Variable key

    [ https://issues.apache.org/jira/browse/FREEMARKER-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16123223#comment-16123223 ] 

Daniel Dekany edited comment on FREEMARKER-69 at 8/11/17 11:37 AM:
-------------------------------------------------------------------

It's a design decision in FreeMarker that user refined directives (including macros) and user defined functions are just variables. They all use the same namespace.  To be more precise, directives and functions are first class values, that is, you can pass them around just like strings or numbers or anything else. So with {{<#macro foo>}} you create a value of type macro, and then assign that to the variable {{foo}} (similarly as {{<#assign foo = ...>}}).


was (Author: ddekany):
It's design decision in FreeMarker that user refined directives (including macros) and user defined functions are just variables. They all use the same namespace.  Also, directives and functions are first class values, that is, you can pass them around just like strings or numbers or anything else. So with {{<#macro foo>}} you really just create a value of type macro, and then assign it to variable {{foo}} (similarly as {{<#assign foo = ...>}}).

> Chinese:自定义Directive与Variable变量名称一致导致FTL解析BUG,English:A bug when The  user-defined directive key same as Variable key 
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-69
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-69
>             Project: Apache Freemarker
>          Issue Type: Bug
>            Reporter: pengzhistar
>            Priority: Minor
>         Attachments: Freemarker.rar
>
>
> Exception info:
> For "@" callee: Expected a(n) user-defined directive, transform or macro, but this has evaluated to a sequence (wrapper: f.t.SimpleSequence): 
> Advise:
> Chinese:将directive对象和临时变量对象分开存储
> English: Separately store directive objects and temporary variable objects 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)