I've implemented the 'classify' statement in the Tart compiler, which is similar to a switch statement, except that it switches based on the type, rather than the value of an expression.
Here's an example:
let e:Object = "H"; classify e { as s:Exception { /* do something with 's' */ } as a:int[] { /* do something with 'a' */ } else { /* 'e' is some other type. */ } }
The classify statement works with both reference types and union types.classify e as s:String { /* do something with 's' */ }