# Extension functions

Mark the first parameter extension to let an ordinary function use readable value.Method(...) call syntax.

Last updated: 2026-09-09

Package: language | Status: stable

Tags: cpu, extension, functions, 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
Function(Type extension value, ...) -> ReturnType
value.Function(...)
```


## 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.language__extension_functions"
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/language--extension-functions/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
