language · language ·

Yielding functions

yield can produce a sequence of values from one function, but the final lowering operation is deliberately rejected by Kyber today.

boundariescpulanguageyehoyield

Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.

yield expression

Status: generated-cpp-only

Oracle route

Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.

cpu · language · type checked

Collect() -> list of int
{
    yield 4
    yield 7
}

list of int values = Collect()
project.mech
manifestVersion = "2"
package = "api.example.language__yielding_functions"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

Kyber-ready alternative

Return a concrete list in Kyber-ready code. Use yield only in the explicit comparison lane while studying the future generator contract.

cpu · language · type checked

Collect() -> list of int
{
    return [4, 7]
}
project.mech
manifestVersion = "2"
package = "api.example.language__yielding_functions"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Notes and source

Forge records yield as a distinct semantic operation.

The generated C++ comparison fixture executes it; Kyber rejects the final-deferred operation explicitly.

yeho/tests/compiler/forge-contract/yield/start.yh; docs/tooling/forge-v2-contract.md