func (v *Value) IsSymbol() bool {
	return v.t == T_STRING && v.t == UT_SYMBOL
}
bool is_symbol() const { return t == T_STRING && u == UT_SYMBOL; }
package sciter
import (
	"fmt"
	"runtime"
)
type NativeFunctor func(args ...*Value) *Value
type valueError struct {
	Result  VALUE_RESULT
	Message string
}
func (e *valueError) Error() string {
	return fmt.Sprintf("%s: %s", e.Result.String(), e.Message)
}
func newValueError(ret VALUE_RESULT, msg string) *valueError {
	return &valueError{
		Result:  ret,
		Message: msg,
	}
}
func wrapValueResult(r VALUE_RESULT, msg string) error {
	if r == VALUE_RESULT(HV_OK) {
		return nil
	}
	return newValueError(VALUE_RESULT(r), msg)
}
func valuePanic(result uint, message ...interface{}) {
	panic(&valueError{VALUE_RESULT(result), fmt.Sprint(message...)})
}
func NewValue(val ...interface{}) *Value {
	v := new(Value)
	v.init()
	runtime.SetFinalizer(v, (*Value).finalize)
	if len(val) == 0 {
		return v
	}
	v.Assign(val[0])
	return v
}
func (v *Value) finalize() {
	v.clear()
}
func (v *Value) Release() {
	runtime.SetFinalizer(v, nil)
	v.finalize()
}
func (v *Value) Assign(val interface{}) {
	switch val.(type) {
	case string:
		s := val.(string)
		v.SetString(s)
	case int:
		i := val.(int)
		v.SetInt(i)
	case float64:
		f := val.(float64)
		v.SetFloat(f)
	case bool:
		i := 0
		if val.(bool) {
			i = 1
		}
		v.SetInt(i)
	case float32:
		v.Assign(float64(val.(float32)))
	case uint:
		v.Assign(int(val.(uint)))
	case uint32:
		v.Assign(int(val.(uint32)))
	case uint64:
		v.Assign(int(val.(uint64)))
	case int32:
		v.Assign(int(val.(int32)))
	case int64:
		v.Assign(int(val.(int64)))
	case Value:
		vf := val.(Value)
		v.Copy(&vf)
	case *Value:
		v.Copy(val.(*Value))
	case NativeFunctor:
		v.SetNativeFunctor(val.(NativeFunctor))
	case func(args ...*Value) *Value:
		v.SetNativeFunctor((NativeFunctor)(val.(func(args ...*Value) *Value)))
	default:
		nf, ok := val.(NativeFunctor)
		if ok {
			v.SetNativeFunctor(nf)
		} else {
			panic("unsupported value type")
		}
	}
}
func (v *Value) IsUndefined() bool {
	return v.t == T_UNDEFINED
}
func (v *Value) IsBool() bool {
	return v.t == T_BOOL
}
func (v *Value) IsInt() bool {
	return v.t == T_INT
}
func (v *Value) IsFloat() bool {
	return v.t == T_FLOAT
}
func (v *Value) IsString() bool {
	return v.t == T_STRING
}