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 enjoyed this article about personal project programming, but I particularly liked this definition:
"Production code has a phone number to call when it breaks"
I'm trying to decide what program I should show on the home page of my PL.
Hello World is too simple to show much syntax. Fibonacci is OK but the reader may not know what print(fib(10)) should show.
Maybe print(greet("World")) is better? It gives you a function definition at least.
I'm changing method definition syntax in my language:
// old
fun (this: Int) inc(): Int { this + 1 }
// new
method inc(this: Int): Int { this + 1 }
The original syntax was inspired by Go, but the new syntax is more grep-friendly and perhaps more readable. Not sure about the verbosity though. Thoughts?