On Sat, Jan 31, 2009 at 8:53 PM, greg_l_at_wikipedia
<greg_l_at_wikipedia(a)comcast.net> wrote:
Aryeh, this reaction of "We do not want to create
a new parser
function for every presentational template people come up with" is
understandable. However, I understand that a character-counting parser
function in another form has been in the works for a long time but
hasn't proven to be reliable enough to be released into the wild.
It would be trivial to write up such a function, and in fact plenty of
people have. I could add it right now in five minutes. The question
is whether it's desirable to make templates into more of a
full-fledged programming language than they already are. There's been
reluctance on many people's part to do that. Personally, I think
they're close enough anyway so that you may as well give them some
basic string functions like {{#len:}}, if the Lua proposal isn't
accepted.
The only reason {val} doesn't
work well is because it must rely upon math-based parser functions
that produce rounding errors.
As I said in my other response, the exact same errors occur in PHP,
and the same type of error occurs in all programming languages. If
you aren't familiar with floating-point calculations, see:
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
In a real programming language, of course, there would be workarounds
like defining new data types, whereas in template programming that
would be tricky.