Automatic boolean to string conversion in 2.3.20. Will this be OK?
Daniel Dekany <[email protected]> Sat, 1 Jun 2013 16:05:37 +0200
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a bigger language change in 2.3.20 based on user request(s),
so if you see any problems with it (like even compatibility issues),
please comment:
Boolean values will be automatically converted to string where a
string value is expected by the template language, instead of
giving an error. Thus, you don't have to use ?string anymore after
booleans on those places. This is exactly the same logic as with
numbers, which were automatically converted to string earlier too.
The most important consequence of this is that instead of
${someBoolean?string} now you can just write ${someBoolean}, and
it will format the boolean according the current boolean_format
setting (by default "true" and "false"), just like ?string did.
Note that just like with numbers, automatic conversion doesn't
happen in these cases:
- Comparisons, i.e., someBoolean == 'true' is still an error
- Method calls where the declared type of the parameter is String
but the actual value is a boolean; still an error
- When the boolean value is used as key in expr[key], it's still
an error (there was no automatic conversion there for other
types either, as numerical and string keys have different
meaning)
- The opposite direction, i.e., string to boolean conversion;
still won't happen
This change is already implemented:
https://github.com/freemarker/freemarker/commit/27e59f51617a72a107f101194396c4c148588ef7
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2