I want to create a new functional language.
Most of you are not developers. This is not for you… Sorry, but that’s how posting works, everyone gets to see it. Others are, and will be tutting at that first line. “What, another one!!!” is what they’re thinking, and I agree. But, I have the bug. I am doing this.
At this time the most popular and/or forward thinking languages are crossing the line between imperative and functional. Kotlin is imperative, but with a lot of functional goodness. Haskell is pure functional, but has IO monads as a way of behaving more like an imperative language.
I wonder if we can do better. This is what I am thinking:
- Grammer and vocabulary that are familiar to the imperative programmer. To my mind one of the drawbacks to the current crop of pure functional languages is their heavy reliance on symbols and strangely named things that make most people scratch their heads. When you spend enough time the concept of monad turns out to be quite simple, it’s the name, descriptions and documentation that suck. Let’s pull back a bit and use a vocabulary that the majority of developers will recognise. I am thinking of something that straddles the line between Kotlin and Python, with a light sprinkling of Haskell.
- No standard library. That doesn’t mean that there aren’t standard algorithms or structures, just that there is no external dependency beyond the binary itself and libc. Ideally a small hello world program should load as fast as its C equivalent and not be more than twice the size.
- Following on from point 2, it should use reference counting memory management. Garbage collection implies a large and complex algorithm to manage the heap. We can use the functional nature of the language to reduce the overhead of reference counting (just like Haskell reduces the overhead of GC), and steal some tricks from Swift.
- Implicitly parallel. You have a four core machine!.. Great. No special tricks. No understanding threads or locking semantics. It just works… So… No pressure.
- No curly braces for basic blocks like Kotlin has, but also, no indent based grammar like Python has. It can be done, you just have to make the decision very early so that grammar decisions are made wisely to stay on the path.
- Generics. Kotlin and Haskell have generics, albeit by different names. Python has duck typing. I’d like to lean more towards the Haskell end of the spectrum, but using a more Kotlin inspired syntax.
- Unused memory should be released to the host quickly.
This is just a starter list. I have began prototyping, with the goal to have a very simple hello world working soon. That means getting heap management working, function calling, type inference and IO.
What do you think. Am I a fool to try, or do you with me luck?