Re: Preserving ordering in a Freemarker sequence when iterating over an OrderedBidiMap.

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
It was always my opinion that our SimpleXxx classes are useful for  
setting up data from code that is FreeMarker aware, but that they  
aren't necessarily good for wrapping existing Maps and Lists.  
Especially considering that they don't actually wrap, they copy.  
BeansWrapper is very low-cost in that it involves no data copying, and  
it also doesn't change any of the operational semantics of the wrapped  
objects (i.e. iteration order, which at least in this case is partly  
due to the fact that whoever wrote "OrderedBidiMap" bungled it and  
didn't implement the SortedMap interface on it).

It's a good thing that DefaultObjectWrapper (which extends  
BeansWrapper) will jointly handle DOM, Jython, Rhino, and Beans  
wrapping, but I do dislike the fact that it overrides the BeansWrapper  
behaviour for Maps and Lists. So yes, it'd be nice to do this change  
for 2.4.

Attila.

On 2008.02.06., at 2:11, Daniel Dekany wrote:

> Monday, February 4, 2008, 7:29:08 PM, Jonathan Revusky wrote:
>
> [snip]
>> I'm actually starting to wonder whether it is worth doing this. It  
>> would
>> be a lot simpler really, starting in 2.4, to just use the  
>> BeansWrapper
>> for lists and maps as well.
> [snip]
>
> That's exactly what I wanted to say. Add this to that list of pending
> 2.4 issues. Of course, Attila will be the main expert here.
>
> -- 
> Best regards,
> Daniel Dekany

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.