language · keyword ·
extension
Bind an extension receiver parameter
Use an extension when behavior conceptually belongs beside a type but you do not own or should not expand the type declaration.
extensionStatus: stable
Complete extension functions example
Use an extension when behavior conceptually belongs beside a type but you do not own or should not expand the type declaration.
cpu · language · type checked
thing Point
{
int x
int y
Point(int x, int y) { this.x = x this.y = y }
}
Magnitude(Point extension value, int offset = 0) -> int
{
return value.x + value.y + offset
}
Point point = Point(1, 5)
Console.Log(Text.From(point.Magnitude(offset: 7)))
project.mech
manifestVersion = "2"
package = "api.example.word__extension"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Notes and source
extension is a binding mode on the first parameter.
The direct function remains explicit and testable even though call syntax reads like a method.
yeho/tests/compiler/kyber/legalized-call-forms/start.yh; parser_types.cpp parseParameters