freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dániel Dékány (Jira) <>
Subject [jira] [Commented] (FREEMARKER-131) Add distinct built-in to sequence
Date Wed, 12 Feb 2020 11:18:00 GMT


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

View raw message