Re: [Freemarker-devel] Ideal tag syntax; what's your take on it?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user,gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <[email protected]> |
Friday, June 10, 2011, 2:46:27 AM, Daniel Henrique Alves Lima wrote:
>
>
> Daniel Dekany wrote:
>>>>
>>>>
>>> <img src="${createLinkTo dir:'images', file:'logo.jpg'}" />
>>>
>>> <img src="${createLinkTo file:'images/logo.jpg'}" /> (it's not a syntax problem)
>>>
>>>
>>> ?
>>>
>>
>> You mean parenthesisless calls? Those can look cute, but they have a
>> great potential to cause headaches for the language designer (or for
>> the user). Like, this:
>>
>> ${foo -1}
>>
>> Does it mean `${foo(-1)}` or `${foo - 1}`? Or even is `${foo}` a
>> method call or just printing the value of foo? (Typical quick answer:
>> Let's check the runtime type of `foo`, and if it's a callable...
>>
>
> I agree. It should be unambiguous.
>
> ${foo: 1} is an option for a method call, but this can clash with a map
> literal(?)
It doesn't clash with that. The '${' and '}' belongs to the
interpolation, so the expression to evaluate is clearly:
foo: 1
> ${foo} printing value
> ${foo:} method call?
In principle it is... (However it's kind of weird because a colon
visually indicates that something is coming after it, but there
nothing is coming.)
> ${foo - 1} = foo - 1
> ${foo: -1} method call
and
${foo - 1} = A FAQ :)
> But
>
> ${foo: [a: 12, b: 3]} // [a: 12, b: 3] is a map literal
>
> ${foo: param1: 12, param2: 13}
>
> Is 'param1: 12' a function call or a named arg?
No ambiguity there, it's a function call. However it's not consistent
with [@fooDirective 1], which is unfortunate. Unless that should be
[@fooDirective: 1] too, but that would be too noisy for a such common
case. And really, if you just want to insert the return value of a
function, why not just call it like [@foo 1]? That said, functions and
directives should be united. Then there's no need for the ${...}
trick. That's also something that not really possible in FreeMarker;
uniting these two concepts, because it has no true automatic escaping.
(But not a problem, we aren't necessary talking abut FM here... I just
want to see what people think.)
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev