Saturday, July 18, 2009

A new direction for Reia: Peridot?

I've always viewed Reia as what I hoped to become a spiritual successor for Ruby in the same way that Ruby was the spiritual successor of Perl. Talking with one of my roommates he pointed out that pearls and rubies are the birthstones of June and July respectively, so an interesting name for the spiritual successor of Ruby would be Peridot. If I had the chance to do it all over again, I'd probably would've named Reia as Peridot instead, but as it stands I've already built up a decent degree of mindshare around "Reia" so renaming the language probably isn't practical. I'll come back to Peridot in a bit.

When I first started using Erlang one of the first things I wanted to do was give it a Ruby-like syntax. It seems like two of the biggest reasons people starting out in Erlang reject it is because of the ugly syntax and single assignment. Lately I've been wondering if there would be value in a language which is semantically identical to Erlang except with destructive assignment and a Ruby-like syntax. Lisp Flavored Erlang has seen a lot of interest and is a much simpler undertaking than Reia because it merely provides an alternative syntax and doesn't try to add new and complex semantics to the language. Perhaps there's a niche for a "Ruby-flavored Erlang" which provides a Ruby-like syntax, destructive assignment, and possibly a bit of syntactic sugar while preserving the underlying semantics of Erlang and not trying to add anything new.

With Reia in its current form I feel like I've bit off a bit more than I can chew. Worse, for the past few months I've been stuck on a particularly difficult problem and also very busy. I feel like perhaps I've bit off a bit more than I can chew implementing Reia, and some bad decisions in the initial compiler design plus my frustration with Erlang syntax have left me wanting to rewrite the compiler as a self-hosted implementation. But I don't think Reia as a language is ready for that yet.

Another thing that has popped onto the scene is neotoma, a Parsing Expression Grammar-based parser generator for Erlang. Ever since I began implementing interopolated strings in Reia I have longed for something like this. I have hacked and kludged my way along implementing interpolating with leex and yecc, but a PEG would solve the issue completely and allow for nested interpolated strings of the sort Ruby supports. This has left me wanting to rewrite the scanner/parser for Reia using neotoma instead.

So what to do? How should I proceed? The idea of a simpler Reia has certainly been bouncing around in my head for awhile. I am seriously thinking of reinventing Reia as something more like Erlang, then continuing on to add things like an object system in a new language: Peridot. There are a number of interesting things this would allow. First, Reia would effectively provide a subset of what's in Peridot, and most Reia programs would be valid Peridot programs. In that regard, Reia would work something like RPython and would make a great bootstrap language for implementing Peridot. A reduced Reia would be much easier to get to production quality than one which incorporates all of the elaborate features I've currently tried to implement. And it would once and for all put to rest the complaints about Erlang syntax and single assignment.

I'm interested to hear what people think about this proposal.