You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Dániel Dékány (Jira)" <ji...@apache.org> on 2020/02/12 11:18:00 UTC

[jira] [Commented] (FREEMARKER-131) Add distinct built-in to sequence

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

Dániel Dékány commented on FREEMARKER-131:
------------------------------------------

What's the use case for this, and how much that can be seen as a proper use of templates? Proper use broadly speaking means that it deals with presentation issues, that therefore the data-model is not expected to address. (Like, it gives you the properly prepared data structure, but only because of the visual design you need to do some more twists.)

Why I'm asking is this. This is the sort of thing like {{?groupBy}}, and a few such transformations. People often want them, but that's certainly most often because they only have immediate power to edit the template, and pushing back these on whoever prepares the data-model would be slow. Especially for 3rd party frameworks, you are often stuck with what you have. So, yeah, we could add these, but then suddenly it would be considered as the norm (do transformations inside the template), after all, we officially can do it. It will be of course still quite limited compared to a real language, and it will probably yield even more requests for even more complex use cases. So that's the tendency I'm afraid of, when adding things like this.

> Add distinct built-in to sequence
> ---------------------------------
>
>                 Key: FREEMARKER-131
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-131
>             Project: Apache Freemarker
>          Issue Type: Wish
>            Reporter: Jasper de Vries
>            Priority: Major
>
> {code}
> ["a", "a", "b", "c", "c"]?distinct
> {code}
> should return:
> {code}
> ["a", "b", "c"]
> {code}
> Order does not matter, you can always sort later if it does.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)