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

Daniel Dekany commented on FREEMARKER-21:
-----------------------------------------

Well, after several years of FM2 maintenance I know pretty much all the 
unspeakable horrors of FM2 :), but that it throws an exception there 
({{InvalidReferenceException}}, "The following has evaluated to null or 
missing: foo") is not among them. It's quite common solution actually. 
{{(...)\!exp}} is basically an {{InvalidReferenceException}} exception handler 
facility, and that's something I do want to change in FM3 though... but that's 
another topic.

FM3 related stuff should be discussed on the dev list.

> Reference to the object in condition - avoid repeating the same in #if and 
> ${...}
> ---------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-21
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-21
>             Project: Apache Freemarker
>          Issue Type: New Feature
>          Components: engine
>            Reporter: Ondra Žižka
>
> Repeating stuff is annoying, especially in programming.
> Therefore this is annoying:
> {code}
> <#if someVariable.someMethod.someProperty??>
> <div>${someVariable.someMethod.someProperty}</div>
> </#if>
> {code}
> This would be better:
> {code}
> <#if someVariable.someMethod.someProperty?? as value>
> <div>${value}</div>
> </#if>
> {code}
> Not talking about the fact that it could only be evaluated once.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to