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

Daniel Dekany commented on FREEMARKER-62:
-----------------------------------------

As accumulating everything that an {{Iterator}} gives into memory is kind of 
dangerous, I'm not really the fan of the idea that such things should happen 
transparently for all built-ins (like {{?size}} too). For {{?sort_by}} it's 
obvious (for some users) that everything will have to be accumulated in memory, 
but it's perhaps better to remain consistent with the other built-ins. So I 
wonder if {{?sequence}} added in 2.3.27 addresses this issue adequately.

> ?sort_by to accept Iterable
> ---------------------------
>
>                 Key: FREEMARKER-62
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-62
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 2.3.26-incubating
>            Reporter: Ondra Žižka
>            Priority: Minor
>
> Currently, {{?sort_by()}} only accepts a {{List}}.
> It's not complicated to create an {{iteratorToList() FreemarkerMethod}}, 
> though.
> So this is a suggestion to make {{?sort_by}} accept an {{Iterable}}, and if 
> it detects it was called for Iterable and not a List, it would create the 
> sorted list. It could use heapsort maybe.



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

Reply via email to