vm/ops.go
func txFunCall(st *State) {
	// Everything in our lvars up to the current tip is our argument list
	mark := st.CurrentMark()
	tip := st.stack.Size() - 1
	var args []reflect.Value

	if tip-mark-1 > 0 {
		args = make([]reflect.Value, tip-mark-1)
		for i := mark + 1; tip > i; i++ {
			v, _ := st.stack.Get(i)
			args[i-mark] = reflect.ValueOf(v)
		}
	}

	x := st.sa
	st.sa = nil
	if x == nil {
		// Do nothing, just advance
		st.Advance()
		return
	}

	v := reflect.ValueOf(x)
	if v.Type().Kind() == reflect.Func {
		fun := reflect.ValueOf(x)
		invokeFuncSingleReturn(st, fun, args)
	}
	st.Advance()
}
func txFunCall(st *State) {
	// Everything in our lvars up to the current tip is our argument list
	mark := st.CurrentMark()
	tip := st.stack.Size() - 1
	var args []reflect.Value

	if tip-mark-1 > 0 {
		args = make([]reflect.Value, tip-mark-1)
		for i := mark + 1; tip > i; i++ {
			v, _ := st.stack.Get(i)
			args[i-mark] = reflect.ValueOf(v)
		}
	}

	x := st.sa
	st.sa = nil
	if x == nil {
		// Do nothing, just advance
		st.Advance()
		return
	}

	v := reflect.ValueOf(x)
	if v.Type().Kind() == reflect.Func {
		fun := reflect.ValueOf(x)
		invokeFuncSingleReturn(st, fun, args)
	}
	st.Advance()
}
// Function calls (NOT to be confused with method calls, which are totally
// sane, and fine) in go-xslate is a bit different. Unlike in non-compiled
// languages like Perl, we can't just lookup a function out of nowhere
// with just its name: Golang's reflection mechanism requires that you
// have a concret value before doing a lookup.
//
// So this is not possible (where "time" is just a string):
//
//  [% time.Now() %]
//
// However, it's possible to register the function itself as a variable:
//
//  tx.Render(..., map[string]interface {} { "now": time.Now })
//  [% now() %]
//
// But this requires function names to be globally unique. That's not always
// possible. To avoid this, we can register an OBJECT named "time" before hand
// so that it in turn calls the ordinary time.Now() function
//
//  // Exact usage TBD
//  tx.RegisterFunctions(txtime.New())
//  tx.Render(...)
//  [% time.Now %]
// ...And that's how we manage function calls
// See also: