Just a thought, I assume that something like the following will be legal:
given $msg {
when Message::ACK {
$msg_store.fetch( $msg.acknowledged_msg ).set_state($msg);
}
when Message::SMS {
when .is_incoming { ... }
when .is_outgoing { ... }
default { die "$msg is neither coming nor going" }
}
}
Yeah, it's not good style; I should really be doing
$msg.dispatch_to($self)
or some such trick and letting polymorphism be my aid and comforter,
but it's illustrative.
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?