{"id":"word--static","name":"static","owner":"yeho","package":"language","kind":"keyword","signature":"static","description":"Attach a member to the type","context":"Use a constructor to establish valid starting data, an instance method for behavior that belongs to one value, and static only when no instance state is needed.","parameters":[],"returns":"","members":[],"tags":["complete-program","cpu","data","keyword","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"tests/compiler/kyber/plain-data-constructor/start.yh; tests/compiler/kyber/legalized-call-forms/start.yh"},"status":"stable","notes":["Stored constructor values follow declaration order for the current value-data ABI.","Class dispatch remains a separate oracle-only boundary even though plain-data constructors and direct admitted calls run through Kyber."],"examples":[{"id":"complete","title":"Static plain data method","description":"Use a constructor to establish valid starting data, an instance method for behavior that belongs to one value, and static only when no instance state is needed.","code":"thing pair\n{\n    int left\n    int right\n}\n\nclass pairMath\n{\n    static Make(int left, int right) returns pair\n    {\n        pair value = pair()\n        value.left = left\n        value.right = right\n        return value\n    }\n\n    static Sum(pair value) returns int\n    {\n        return value.left + value.right\n    }\n}\n\npair value = pairMath.Make(20, 22)\n\nif pairMath.Sum(value) == 42\n{\n    Console.Log(\"static-plain-data-method-ok\")\n}\n\n\n","manifest":"package = \"tests.compiler.kyber.staticPlainDataMethod\"\nversion = \"0.1.0\"\nbackend = \"kyber\"\nosTarget = \"windows\"\narchTarget = \"x64\"\nselfContainedApp = false\n\n\n\n","tags":["cpu","complete-program"],"verification":"type checked","run":"cpu-oracle","source":"tests/compiler/kyber/static-plain-data-method/start.yh","sha256":"91aa2b1aef2939424577798f6b57ae2a807541665ee55d18eacd0542ec890f9a","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=word--static","json":"https://demonhunterlabs.com/reference/items/word--static.json","markdown":"https://demonhunterlabs.com/reference/text/word--static.md"}
