[ 
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:41 AM:
-------------------------------------------------------------------

It's a design decision in FreeMarker that user defined 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 = ...>}}).

Many other languages does the same, but of course different people prefer 
different approaches. But surely changing this is not backward compatible.


was (Author: ddekany):
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 = ...>}}).

> 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)

Reply via email to