I feel like enums/variants/tagged unions are underexplored in dynamically typed languages.
As soon as you see a pattern match for a given enum variant (e.g. colour::RED), your can IDE can be helpful if the enum definition changes. Normally I only get this with static typing.
miniblog.
Related Posts
I really like pattern matching in Rust, but I find myself using it less and less.
`if let` and `let ... else` require substantially less indentation, and I often use them for Option values.
I don't miss this syntactic sugar in OCaml though. Maybe it's just because OCaml has a 2 space indent, unlike Rust's 4 space indent?
Here's a weird UI pattern I haven't seen before. This sanitizer will keep things clean for 24 hours, so the time counts *down*.
Every time I see it, it looks like 24 hour clock showing the wrong time!
Are there any languages that have both pattern matching and statement oriented syntax?
In principle these are orthogonal, but I'm struggling to think of a language with pattern matching that isn't expression oriented.
