Re: [FreeMarker-user] FreeMarker 2.4 Preview 1 (unstable) is out

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.devel,gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Saturday, August 9, 2008, 1:21:30 PM, Mauro Talevi wrote:

> Daniel Dekany wrote:
>> This is a preview release of the a yet unfinished FreeMarker 2.4, so
>> it's for advanced users and experts who would like to give feedback.
>> Don't use it in production environment!
>> 
>> Download: http://prdownloads.sourceforge.net/freemarker/freemarker-2.4pre1.tar.gz
>> 
>> What's new: http://freemarker.org/docs-24pre1/versions_2_4_pre1.html
>> 
>> All feedback is welcome!
>> 
>
> Well - quite an impressive new features set!
>
> A few comments:
>
> - [A general comment on version] Given the amount and scope of new 
> features - not least the introduction of null and the JDK 1.5 
> requirements - and the backward incompatibility perhaps a version 3.x
> would be appropriate as a signal to the user.  Most people would expect
> a change from 2.3 to 2.4 to introduce new features that are backward 
> compatible or perhaps just introduce some deprecation, but not be wholly
> backward incompatible.

I don't know... but now it would be quite messy to start calling it
3.x. BTW, the reason of backward incompatible changes is simply that
some old mistakes can't be fixed backward compatibly, and not that
there is something very new or revolutionary. And the version policy
of FreeMarker clearly states on the download page that the second
version number changes may mean backward incompatibility... surely not
everyone reads it.

> - [Migration issue] As I use quite frequently Map key iteration (eg via
> Map.keySet()) I've hit upon this change:
> "Warning, backward incompatible change! The default of simpleMapWrapper
> property of BeansWrapper is true now. This means that the methods and 
> fields of Map-s will not be exposed by default, only the pure key-set 
> will define the subvariables of the templates. Note that the default 
> object wrapper of FreeMarker always had simpleMapWrapper set to true, so
> if you have used only the default object wrapper, then there is no 
> change for you."
>
> What is the rationale behind this?

You meant to use theMap?keys for listing the keys (always), not
Map.keySet() directly. Is that inappropriate in your case? The reason
of the change is exactly that theMap?keys didn't worked well in 2.3 it
the maps was wrapped with a "pure" BeansWrapper (if you didn't set i's
simpleMapWrapper property of it to true), since it also listed the
method names, not only the keySet of the map.

> And is the proposed solution - setting the object wrapper to
> simpleMapWrapper - compatible with the 2.3.x beanWrapper? If not, it
> would be real show-stopper!

If you just used the default ObjectWrapper, the whole thing doesn't
affect you, since it *always* used simpleMapWrapper=true. If you have
used a "custom" ObjectWrapper instance instead, then certainly you
configure that wrapper somewhere, so all you have to do is to specify
the simpleMapWrapper property of it explicitly (rather than leaving it
on its default value), and then the stuff will behave the same both on
2.3.x and 2.4.x.

> Hence trying to understand the need for the change. To be specific,
> would this behaviour be configured via the "object_wrapper" param in
> the freemarker servlet by setting it "simple_map" or "map"?
>
> Thanks and cheers!

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
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.