# as

Cast to a named type

Last updated: 2026-09-09

Package: language | Status: experimental

Tags: cpu, keyword, language, logic, yeho

Prefer designs that already know their types. Use is/as at admitted dynamic boundaries and keep failure handling explicit.

```yh
as
```


## Complete program

Use a checked class boundary before reading the pilot-specific callsign.

Verification: type checked

```yh
class Actor { }
class Pilot extends Actor { text callsign = "Nova" }
Actor actor = Pilot()
if actor is Pilot
{
    Pilot pilot = actor as Pilot
    Console.Log(pilot.callsign)
}

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.word__as"
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--as/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Complete class/reference flow is oracle-only today, so this is not a general Kyber dynamic-object promise.

The target after is or as is currently a named type.

Source: yeho/parser_expressions.cpp parseComparison; semantic/expr.cpp

AI training permission: https://demonhunterlabs.com/ai-use
