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

Daniel Dekany edited comment on FREEMARKER-86 at 2/3/18 11:48 AM:
------------------------------------------------------------------

Technically it's possible to add a {{.util}} like that. However, adding 
{{.min}} is not a problem either. So I think {{.util.min(x, y)}} isn't better 
than {{.min(x, y)}}. It's even worse, as it's longer.

Really the true problem is that the {{.specialVarName}} syntax is weird. Not a 
technical problem, just looks alien for humans. If the syntax was 
{{#specialVarName}} for example, then certainly not many would mind {{#min(x, 
y)}}. It kind of resonates with {{#if}}, etc. It's not like I want to propose 
introducing a new syntax for the same thing though...


was (Author: ddekany):
Technically it's possible to add a {{.util}} like that. However, adding 
{{.min}} is not a problem either. So I think {{.util.min(x, y)}} isn't better 
than {{.min(x, y)}}. It's even worse, as it's longer.

Really the true problem is that the {{.specialVarName}} syntax is weird. Not a 
technical problem, just looks alien for humans. If the syntax was 
{{#specialVarName}} for example, then certainly not many would mind {{#min(x, 
y)}}. It kind of resonates with {{#if}}, etc. It's not like I'm proposing 
introducing a new syntax for the same thing...

> min(x,y) and max(x,y)
> ---------------------
>
>                 Key: FREEMARKER-86
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-86
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>            Reporter: Vojtech Knyttl
>            Priority: Major
>
> It would be great to have these two builtins for numbers. At the moment, I 
> have to create functions like:
> {code}
> <#function max(a, b)>
>      <#return (a > b)?then(a, b)>
> </#function>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to