Move 2024 introduces native `enum` definitions and `match` expressions, allowing rich polymorphic data structures without untyped byte serialization.
move
public enum Action has drop {
Stop,
Move { x: u64, y: u64 },
Teleport(address),
}
public fun execute(a: Action) {
match (a) {
Action::Stop => (),
Action::Move { x, y } => update_pos(x, y),
Action::Teleport(dest) => warp(dest),
}
}