freemarker Static[UtilMisc].toMap() use

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

freemarker Static[UtilMisc].toMap() use

Adam Heath-2
I just noticed that several(many) ftl files use UtilMisc.toMap, but
others are using {}(freemarker syntax).  I assume we would like the
latter to prevail.  Agreements?
Reply | Threaded
Open this post in threaded view
|

Re: freemarker Static[UtilMisc].toMap() use

Adam Heath-2
On 12/09/2010 01:58 PM, Adam Heath wrote:
> I just noticed that several(many) ftl files use UtilMisc.toMap, but
> others are using {}(freemarker syntax). I assume we would like the
> latter to prevail. Agreements?

Same goes for UtilMisc.toMap and UtilMisc.toList inside groovy; groovy
has native support for map/list creation, and imho should be preferred.
Reply | Threaded
Open this post in threaded view
|

Re: freemarker Static[UtilMisc].toMap() use

Jacques Le Roux
Administrator
Yes I agree, why not use an idiomatic syntax when it exists?
 I guess some persons prefer to have the same syntax everywhere or even don't know the idiomatic syntax (or maybe in some cases
simply C/P snippets from Java)

Jacques

From: "Adam Heath" <[hidden email]>
> On 12/09/2010 01:58 PM, Adam Heath wrote:
>> I just noticed that several(many) ftl files use UtilMisc.toMap, but
>> others are using {}(freemarker syntax). I assume we would like the
>> latter to prevail. Agreements?
>
> Same goes for UtilMisc.toMap and UtilMisc.toList inside groovy; groovy has native support for map/list creation, and imho should
> be preferred.
>


Reply | Threaded
Open this post in threaded view
|

Re: freemarker Static[UtilMisc].toMap() use

Adam Heath-2
On 12/09/2010 04:45 PM, Jacques Le Roux wrote:
> Yes I agree, why not use an idiomatic syntax when it exists?
> I guess some persons prefer to have the same syntax everywhere or even
> don't know the idiomatic syntax (or maybe in some cases simply C/P
> snippets from Java)

The only reason I knew about {} in freemarker is because I saw it
being used.  I am finding all findByAnd calls, to deprecate older
versions, so am getting a chance to look at tons of files.

As for using {} and [] in freemarker, and [:] and [] in groovy, the
native syntax tends to be faster.  Using classes in freemarker and
groovy requires using reflection, which does end up being slower.
Using native syntax all that indirection can be bypassed.