language · language ·

Flags enums

A [flags] enum represents combinable named bits. Test membership with .Has rather than treating a combination as one match case.

Has[flags]cpuenumflagslanguagelogicyeho

Use flags for independent capabilities or state bits that can be combined.

[flags] enum Name { A, B, C }
value.Has(Name.Member)

Status: experimental

Declare named access flags

Store and compare one named document capability. Enum bitwise combinations and native .Has lowering are not qualified by this example.

cpu · enum · flags · executed

[flags]
enum Access { Read, Write }
Access granted = Access.Read
if granted == Access.Read { Console.Log("Read access") }
project.mech
manifestVersion = "2"
package = "api.example.language__flags_enums"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
Read access
Notes and source

Flags enums cannot have payload members.

The parser accepts .Has, but the current CPU oracle build does not lower it. Enum bitwise combinations are also rejected. Use integer masks for executable combinations, or compare one named enum value directly.

yeho/parser_core.cpp parseTopLevelEnum; language-core.md §5.6