On Wed, Jun 21, 2017 at 2:30 PM, Daniel Dekany <ddek...@apache.org> wrote: > Friday, June 16, 2017, 8:41:37 PM, Daniel Dekany wrote: > >> A problem in FM2 is that when calling a directive (as a macro), either >> all parameters are positional (`<@message "Hi" 2 />`), or all >> parameters are named (`<@message content="Hi" height=2 />`); you can't >> mix the two (`<@message "Hi" height=2 />`). Also you can't use named >> parameters for functions/methods, only for directives. Worse, core >> directives don't even use named parameters, but some keyword like >> `as`, `using`... their syntax is hard coded into the parser, which is >> not nice, and will be a problem for the custom dialects feature. >> >> I think that with the exception of a few core directives (see them >> later) all directive calls should be like this, if for now (in this >> thread) we ignore loop variables: >> >> <#name posPar1 posPar2 namedPar1Name=namedPar1Value >> namedPar2=namedPar2Value> > > An adjustment to the above... I think that we should require comma > between positional arguments (but not between positional and named > arguments and between named arguments): > > <#name posPar1, posPar2 namedPar1Name=namedPar1Value > namedPar2=namedPar2Value>
+1 ---->8---->8---- > For function calls, which follow typical C-ish expression syntax, > using commas even between named parameters is the natural thing (as in > `f(1, 2, foo=3, bar=4)`), so I would stick to that. +1 > > [snip] >> parameters is `<#ftl outputFormat='RTF'>`. So far it's the same as in >> FM2. But now we could have both in once call, such as >> `<#visit node handlers=myNamespace>` (regular syntax), which was >> `<#visit node using myNamespace>` in FM2 (irregular syntax hard coded >> into the parser). > [snip] > > For completeness, let's see what other non-regular core directives we > have. > > - For #import I would switch to assignment-like approach: > FM2: <#import "foo.ftl" as f> <#import "bar.ftl" as b> > FM3: <#import f="foo.ftl" b="bar.ftl"> +1 Cool! Cheers, Woonsan > > - #escape doesn't mater, as it will be removed (in favor of output > formats introduced in 2.3.24). > > - #assign has this `in` thing, like `<#assign x = 1 in ns>`. We will > want to allow <#assign ns.x = 1> (actually, #set) anyway, so that > won't mater either. > > -- > Thanks, > Daniel Dekany >