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, 1:34:17 AM, Daniel Henrique Alves Lima wrote:
>
>
> Daniel Henrique Alves Lima wrote:
>>
>> My answers were mostly useless :-|
>>
>> I'm not particularly comfortable with the syntax of JSP and GSP:
>>
>> http://www.grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.2%20Groovy%20Server%20Pages
>>
>> <img src="<g:createLinkTo dir="images" file="logo.jpg" />" />
>>
>>
>> But is there a better way of writing a call to a function using named parameters/args?
>>
>>
>> <img src="${createLinkTo(dir:'images', file:'logo.jpg')}" />
>>
>>
>>
>
> <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...
Right, and then I can write ${someList.size} instead of
${someList.size()} too, right? Because that's maybe a bit too bold.
Yes, Scala does that. Except Scala also have methods where you can't
omit the parentheses because they have side effects. Also Scala is
insanely type-safe, which helps in resolving ambiguities of this kind
(should I call it VS should I just use it as value). Also it assumes
the programmer spent a lot of time with learning Scala, rearranging
his brain. You can't expect that for a template language, so it should
try harder to remain Java-ish.)
--
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