# extension

Bind an extension receiver parameter

Last updated: 2026-09-09

Package: language | Status: stable

Tags: cpu, functions, keyword, language, yeho

Use an extension when behavior conceptually belongs beside a type but you do not own or should not expand the type declaration.

```yh
extension
```


## 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.

Verification: type checked

```yh
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)))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.word__extension"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/word--extension/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


extension is a binding mode on the first parameter.

The direct function remains explicit and testable even though call syntax reads like a method.

Source: yeho/tests/compiler/kyber/legalized-call-forms/start.yh; parser_types.cpp parseParameters

AI training permission: https://demonhunterlabs.com/ai-use
