Control Flow with Type Checking

2021-02-15 Thread johnconway
Thanks Vindaar, that's very clear.

Control Flow with Type Checking

2021-02-15 Thread Vindaar
`tell_type` is an implicit generic procedure due to the `Foo|Bar`. That means for each encountered type for which it is used, a procedure taking that type will be generated. Now, `if` is a runtime construct. So when you say `if ... is T` it's checking at runtime whether something is `T`. What y

Control Flow with Type Checking

2021-02-15 Thread johnconway
Hi, this is probably a stupid newb question, but I don't understand how to implement control flow by checking types. The following code is what I have: import typetraits type Foo = object foos: string type Bar = object bars: string let foo =