Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

bad.gno

1.22 Kb · 37 lines
 1// Package bad is the handler realm that exists to be refused (pattern G; see
 2// ../../README.md).
 3//
 4// It satisfies facade.Handler exactly as well as the others do: same methods,
 5// same signatures, compiles and proposes itself without complaint. What it does
 6// is drop the "upper" verb and change "repeat" to take one argument instead of
 7// two, both of which break a caller already compiled against v0.
 8//
 9// Nothing in gno's type system can see that. A Go interface says what methods
10// exist, not which verbs the data behind them still answers, which is the whole
11// argument for declaring the API as data and diffing it at accept time.
12package bad
13
14import (
15	facade "gno.land/r/moul/x/upgrade/schema/facade/v0"
16)
17
18// schema drops "upper" entirely and gives "repeat" the wrong arity.
19const schema = `repeat s`
20
21type handler struct{}
22
23func (handler) Schema() string { return schema }
24
25func (handler) Invoke(verb string, args []string) string {
26	return "this handler never gets to run"
27}
28
29// Instance exposes the singleton.
30func Instance() facade.Handler { return handler{} }
31
32// Path is this realm's own package path.
33const Path = "gno.land/r/moul/x/upgrade/schema/impl/bad/v0"
34
35func init(cur realm) {
36	facade.Propose(cross(cur), Instance())
37}