Hacker News new | ask | show | jobs
by ralfj 1414 days ago
From a quick scroll, that seems to be just C-style `select` with `if` guards?

What I was referring to is things like `match x { Some(y) => ..., None => ... }`, where there is data that is available only in some variants of the type (like `y`). Without a type, even naming these variants becomes an interesting problem. (Not unsolvable, mind you. But not obvious either, and you lose some of the benefits that algebraic data types have in typed languages.)

1 comments

No, it matches on the structure of data as well as embedded values. E.g. you can match on %{foo: y} vs %{bar: y}.