|
Joubin Houshyar |
at Oct 19, 2012 at 10:13 pm
|
⇧ |
| |
On Fri, Oct 19, 2012 at 5:27 PM, Rob Pike wrote:
It's a slippery slope thing. Sure, +1 is easy but then you want *2 and
then <<3 and then switch and then closures and so on. Unlike with
templates in other languages, I deliberately chose not to provide a
full programming language, and ask the programmer to use the one
that's already there.
Functions are underappreciated. In general, not just in templates.
Possibility remains to beef up the builtins, and/or export a select subset
(e.g. truth -> Truth) as helpers at the package level. The example just
posted is not doing any type checking, etc. as it
should<
http://golang.org/src/pkg/text/template/funcs.go#L143>.
I think end users would benefit from a refactored length to call a
Container (akin to truth) that can be used to build up their specific
required funcs. "Batteries included".
-rob
--