Piers Cawley writes:
: 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.
Perfectly legal, and okay style, as far as I'm concerned. One often
wants to refine one's tests within a particular case.
Larry