{"id":"language--yielding-functions","name":"Yielding functions","owner":"yeho","package":"language","kind":"language","signature":"yield expression","description":"yield can produce a sequence of values from one function, but the final lowering operation is deliberately rejected by Kyber today.","context":"Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.","parameters":[],"returns":"","members":[],"tags":["boundaries","cpu","language","yeho","yield"],"updated":"2026-09-09","source":{"repository":"yeho","path":"tests/compiler/forge-contract/yield/start.yh; docs/tooling/forge-v2-contract.md"},"status":"generated-cpp-only","notes":["Forge records yield as a distinct semantic operation.","The generated C++ comparison fixture executes it; Kyber rejects the final-deferred operation explicitly."],"examples":[{"id":"complete-0","title":"Oracle route","description":"Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.","code":"Collect() -> list of int\n{\n    yield 4\n    yield 7\n}\n\nlist of int values = Collect()\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__yielding_functions\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"34e7e58265d3abb6038d47d4ddb31017aabe8f06d09d8e01eca86848fdb615d7","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null},{"id":"complete-1","title":"Kyber-ready alternative","description":"Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.","code":"Collect() -> list of int\n{\n    return [4, 7]\n}\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__yielding_functions\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"2514db5f41677f584bad0bf7414f0843135b915b3c3c17e4c9c4b6813fc11ca1","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=language--yielding-functions","json":"https://demonhunterlabs.com/reference/items/language--yielding-functions.json","markdown":"https://demonhunterlabs.com/reference/text/language--yielding-functions.md"}
