{"id":"word--extension","name":"extension","owner":"yeho","package":"language","kind":"keyword","signature":"extension","description":"Bind an extension receiver parameter","context":"Use an extension when behavior conceptually belongs beside a type but you do not own or should not expand the type declaration.","parameters":[],"returns":"","members":[],"tags":["cpu","functions","keyword","language","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"tests/compiler/kyber/legalized-call-forms/start.yh; parser_types.cpp parseParameters"},"status":"stable","notes":["extension is a binding mode on the first parameter.","The direct function remains explicit and testable even though call syntax reads like a method."],"examples":[{"id":"complete","title":"Complete extension functions example","description":"Use an extension when behavior conceptually belongs beside a type but you do not own or should not expand the type declaration.","code":"thing Point\n{\n    int x\n    int y\n    Point(int x, int y) { this.x = x this.y = y }\n}\nMagnitude(Point extension value, int offset = 0) -> int\n{\n    return value.x + value.y + offset\n}\nPoint point = Point(1, 5)\nConsole.Log(Text.From(point.Magnitude(offset: 7)))\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.word__extension\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"7bd72f45551bef046ab22bc7652ac46a8d279ff8b5f52f32ec31b238b859cb89","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=word--extension","json":"https://demonhunterlabs.com/reference/items/word--extension.json","markdown":"https://demonhunterlabs.com/reference/text/word--extension.md"}
