{
	"Named return function": {
		"prefix": "fn",
		"body": [
			"func ${1:Name}(${2:args}) (${3:result} ${4:Type}) {",
			"\t$0",
			"\treturn",
			"}"
		],
		"description": "A Moxie function must name every return value."
	},
	"Pointer receiver method": {
		"prefix": "meth",
		"body": [
			"func (${1:r} *${2:Type}) ${3:Name}(${4:args}) (${5:result} ${6:Type}) {",
			"\t$0",
			"\treturn",
			"}"
		],
		"description": "Only method receivers may be written to, and only a pointer receiver is allowed in user code."
	},
	"Sovereign self-mutating type": {
		"prefix": "sovereign",
		"body": [
			"type ${1:Thing} struct {",
			"\t${2:field} ${3:Type}",
			"}",
			"",
			"func (${4:t} *${1:Thing}) ${5:Add}(${6:v} ${3:Type}) {",
			"\t${4:t}.${2:field} = ${6:v}",
			"}"
		],
		"description": "A named struct with a method that stores into a receiver field owns a sovereign arena."
	},
	"init and zero-value globals": {
		"prefix": "init",
		"body": [
			"var ${1:table} ${2:*Table}",
			"",
			"func init() {",
			"\t${1:table} = new${2:Table}()",
			"}"
		],
		"description": "A program's main package cannot declare init; other packages use init() plus zero-value globals."
	},
	"Slice with length and capacity": {
		"prefix": "slice",
		"body": ["${1:b} := []${2:byte}{:${3:n}:${4:cap}}"],
		"description": "Presize exactly and write through a cursor. There is no make()."
	},
	"Ensure before a spread push": {
		"prefix": "ensure",
		"body": ["${1:b} = mxutil.Ensure(${1:b}, len(${2:src}))", "push(${1:b}, ${2:src}...)"],
		"description": "push does not grow; a spread needs Ensure(len(src)) first."
	},
	"Spawn a worker": {
		"prefix": "spawn",
		"body": [
			"in := chan ${1:Request}{}",
			"out := chan ${2:Response}{}",
			"done := spawn(${3:Worker}, in, out)",
			"\t$0",
			"<-done"
		],
		"description": "Channels are fixed at spawn time; a worker serves its inbox and is never spawned per job."
	},
	"Interface implementation assertion": {
		"prefix": "iface",
		"body": [
			"if ${1:v}, ok := ${2:x}.(${3:fmt.Stringer}); ok {",
			"\t$0",
			"}"
		],
		"description": "There is no reflect and no empty interface; assert to a named interface."
	},
	"Error return": {
		"prefix": "err",
		"body": ["return ${1:zero}, errors.New(\"${2:message}\")"],
		"description": "Named returns plus errors.New from the errors package."
	},
	"Switch without a tag": {
		"prefix": "switch",
		"body": ["switch {", "case ${1:cond}:", "\t$0", "default:", "}"]
	},
	"Kind-switch on an enum": {
		"prefix": "kinds",
		"body": [
			"switch ${1:k} {",
			"case ${2:KindOne}:",
			"\t$0",
			"default:",
			"}"
		]
	}
}
