3 ms·
I rather like how Go decided to handle this, using "type switches": switch x := node.(type) { case Node: // x is of type Node in this block cas
by kiwidrew 15y ago
I rather like how Go decided to handle this, using "type switches":
switch x := node.(type) {
case Node:
// x is of type Node in this block
case Leaf:
// x is of type Leaf in this block
}
(http://golang.org/doc/go_spec.html#Type_switches http://golang.org/doc/go_spec.html#Type_switches)
- redjamjar 15y agoSo whilst it doesn't work yet, I actually will support type switches as well ...