Chapter 57

stub/introspection

github.com/openfluke/welvet/stub/introspection🚧


Why it exists

UIs and FFI need to list Grid methods without hardcoding every export.

What it is

GetMethods, GetMethodsJSON, GetMethodSignature.

Go example

examples/57-stub-introspection/main.go

Run:cd welvet/examples/57-stub-introspection && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/architecture"
	"github.com/openfluke/welvet/stub/introspection"
)

func main() {
	g := architecture.NewGrid(1, 1, 1, 1)
	methods, err := introspection.GetMethods(g)
	fmt.Println(len(methods), err)
}

Output

Run python3 _gen_welvet_book.py --run to capture output.