Do we need another functional language?

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:

  1. 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.
  2. 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.
  3. 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.
  4. Implicitly parallel. You have a four core machine!.. Great. No special tricks. No understanding threads or locking semantics. It just works… So… No pressure.
  5. 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.
  6. 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.
  7. 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?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s