Hi Daniel, > Le 24 nov. 2018 à 20:11, Daniel Dekany <ddek...@apache.org> a écrit : > > Friday, November 23, 2018, 2:54:05 PM, Denis Bredelet wrote: > >> Hi Daniel, >> >> Note this discussion: >> https://issues.apache.org/jira/browse/FREEMARKER-107 >> >> That looks like func.apply() in Javascript right? >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax > > func.apply() gives identical functionality, but no syntax to make it > succinct. Like consider (assuming the syntax is **kwargs, like in Python) > > <#assign commonParams = { 'style': 'foo', 'align': 'left' }> > ... > <@my.fancyInput type='text' size=10 **commonParams /> > > With function.apply-style it's something like: > > <@my?fancyInput?apply({ 'type': 'text', 'size': 10 } + commonParams) /> > > So that does the same without new syntax (it only adds a new built-in, > "apply"), but is more verbose, and it changes the look-and-feel of the > call a lot, just because you happen to need some dynamically added > parameters there.
The extra parameters don’t need to be made into a map. You could just use this syntax: <@my.fancyInput?apply(commonParams) type='text' size=10 /> >> -- Denis. >> >> Another interesting and long missing feature. The question is what the >> syntax should be, especially we need it both for by-position and >> by-name parameter passing. >> > > -- > Thanks, > Daniel Dekany >