func (v *MrbValue) SingletonClass() *Class {
	mrb := &Mrb{v.state}
	sclass := C._go_mrb_class_ptr(C.mrb_singleton_class(v.state, v.value))
	return newClass(mrb, sclass)
}
SingletonClass returns the singleton class (a class isolated just for the
scope of the object) for the given value.
package mruby
import (
	"fmt"
	"strconv"
	"strings"
	"unsafe"
)
import "C"
type Value interface {
	MrbValue(*Mrb) *MrbValue
}
type Int int
type NilType [0]byte
type String string
var Nil NilType
type MrbValue struct {
	value C.mrb_value
	state *C.mrb_state
}
func init() {
	Nil = [0]byte{}
}
func (v *MrbValue) SetInstanceVariable(variable string, value *MrbValue) {
	cs := C.CString(variable)
	defer C.free(unsafe.Pointer(cs))
	C._go_mrb_iv_set(v.state, v.value, C.mrb_intern_cstr(v.state, cs), value.value)
}
func (v *MrbValue) GetInstanceVariable(variable string) *MrbValue {
	cs := C.CString(variable)
	defer C.free(unsafe.Pointer(cs))
	return newValue(v.state, C._go_mrb_iv_get(v.state, v.value, C.mrb_intern_cstr(v.state, cs)))
}
func (v *MrbValue) Call(method string, args ...Value) (*MrbValue, error) {
	return v.call(method, args, nil)
}
func (v *MrbValue) CallBlock(method string, args ...Value) (*MrbValue, error) {
	if len(args) == 0 {
		return nil, fmt.Errorf("args must be non-empty and have a proc at the end")
	}
	n := len(args)
	return v.call(method, args[:n-1], args[n-1])
}
func (v *MrbValue) call(method string, args []Value, block Value) (*MrbValue, error) {
	var argv []C.mrb_value
	var argvPtr *C.mrb_value
	mrb := &Mrb{v.state}
	if len(args) > 0 {
		argv = make([]C.mrb_value, len(args))
		for i, arg := range args {
			argv[i] = arg.MrbValue(mrb).value
		}
		argvPtr = &argv[0]
	}
	var blockV *C.mrb_value
	if block != nil {
		val := block.MrbValue(mrb).value
		blockV = &val
	}
	cs := C.CString(method)
	defer C.free(unsafe.Pointer(cs))
	result := C._go_mrb_call(
		v.state,
		v.value,
		C.mrb_intern_cstr(v.state, cs),
		C.mrb_int(len(argv)),
		argvPtr,
		blockV)
	if exc := checkException(v.state); exc != nil {
		return nil, exc
	}
	return newValue(v.state, result), nil
}
func (v *MrbValue) IsDead() bool {
	return C.ushort(C._go_isdead(v.state, v.value)) != 0
}
func (v *MrbValue) MrbValue(*Mrb) *MrbValue {
	return v
}
func (v *MrbValue) Mrb() *Mrb {
	return &Mrb{v.state}
}
func (v *MrbValue) GCProtect() {
	C.mrb_gc_protect(v.state, v.value)
}
func (v *MrbValue) SetProcTargetClass(c *Class) {
	proc := C._go_mrb_proc_ptr(v.value)
	proc.target_class = c.class
}
func (v *MrbValue) Type() ValueType {
	if C._go_mrb_nil_p(v.value) == 1 {
		return TypeNil
	}
	return ValueType(C._go_mrb_type(v.value))
}
type Exception struct {
	*MrbValue
	File      string
	Line      int
	Message   string
	Backtrace []string
}
func (e *Exception) Error() string {
	return e.Message
}
func (e *Exception) String() string {
	return e.Message
}
func (v *MrbValue) Array() *Array {
	return &Array{v}
}
func (v *MrbValue) Fixnum() int {
	return int(C._go_mrb_fixnum(v.value))
}
func (v *MrbValue) Float() float64 {
	return float64(C._go_mrb_float(v.value))
}
func (v *MrbValue) Hash() *Hash {
	return &Hash{v}
}
func (v *MrbValue) String() string {
	value := C.mrb_obj_as_string(v.state, v.value)
	result := C.GoString(C.mrb_string_value_ptr(v.state, value))
	return result
}
func (v *MrbValue) Class() *Class {
	mrb := &Mrb{v.state}
	return newClass(mrb, C.mrb_class(v.state, v.value))
}