This first development diary is going to be long. There's a lot of thinking to write down before I can catch you up to where I today; July 23, 2022.

The origins of Tuplet

I write a lot of utility scripts. For years I've been writing them in Bash becasue I've wanted them to be something I could share with my peers. One day, I just got sick of having to fight with yet another piece of Bash's weird syntax. I've wanted to write my own language for years, something that was more tailored to the way my brain worked, and the ways I've come to believe a programming language should work.

I decided I wasn't going to fight with Bash any more. I was going to act upon my dreams and build a language for me, but it'd compile to Bash so that I could still create those utility scripts that I could share with my peers. So, that's what I set out to do.

One day I was working out how arrays would function, and I went down a little rabbit hole of what it takes to pass arrays into and out of functions in Bash. It wasn't pretty, and it required Bash 4.4 or higher if you wanted any hope of doing it without truly ugly hacks.

I continued on though, until I tried to write a string-split function as part of the standard library. I ended up on this amazing Stack Overflow answer, and spent the next couple hours trying to make it actually work. The. Next. Couple. Hours. It took me hours, with explicit – although imperfect – instructions to write a function that split a string on spaces. Hours. I've been coding professionally for nearly 30 years, and it took me hours to write a generic form of that function, and I had to compromise to do it too.

That was the "straw that broke the camel's back", but the decision to abandon Bash fully took a couple more days to sink in. It was the realization that even if I did succeed, I couldn't actually give my scripts to any of my peers, because I use macs, and they use macs, and Apple stopped distributing Bash at version 3.2.57. A version that couldn't run the newer functions I'd need anway. Yes, you can upgrade bash on the mac, but I think very few geeks actually do.

On top of that, was the acceptance of the fact that no-one cares about my scripts. I've got tons of things that'd save people time and effort, and when relevant, I let people know about them. They never ask for details. They never run the ones I share. Or if they do, they never tell me about it.

A few more days and the implications of that really sank in.

There is absolutely no point, in my trying to make a language with other people's needs, or convenience, in mind. No-one's going to use it, so why should I make something with compromises to satisfy non-existent users.

Tuplet is my langauge. It's a language for me. It is purely selfish. That's not because I don't want others to use it, but because it's highly unlikely anyone else ever will. Just like it's highly unlikely that anyone will ever read this.

Finding a target

With bash out of the picture I started hunting around for a target language. I was still holding out hopes of "maybe I can make this easy for folks", but one of the languages I was considering anyway was [Janet]( Janet, is a thoroughly modern Lisp. I don't know why it took so long for someone to write such a beast, but what's important is that it exists now.

At this point, I'd been iterating on the grammar for a while and had made a lot of progress. One night, I realized that I wasn't using parentheses for anything, and that that, combined with the fact that I was writing a transpiled language, meant that I could literally write raw lisp in my code, and it would take zero effort to compile it. My parser could literally just go "oh look, stuff in parentheses. Just spit it all out unchanged." This meant that I could trivially bootstrap the language with lisp until I had a standard library written in itself.

It's important to note that Tuplet is basically a lisp. It's heavily inspired by the thinking behind Wisp, otherwise known as SRFI-119. Wisp is basically just "I wish I could write Scheme but with Python style indentation instead of parentheses all over the place." Tuplet takes this idea to the next step. It says "That's cool, but there are a lot of places where languages like Python and Ruby are way, way easier to use."

To put it another way, there are a lot of things I've come to love about Ruby and other modern languages, but I also love writing in Scheme.

Anyway… the realization that there was no real value in catering to others, combined with a love of Scheme, plus a thoroughly modern lisp that I wanted to use, made me decide to use Janet.

Figuring out what I wanted

It's hard to know what you realy want in a language until you start writing one. So, I just started writing down my ideas in an org file, and then writing grammars to generate lexers and parsers. Long story short, much time was spent, and frustration was had until I decided to use Antlr and it's fantastic plug-in for the various JetBrains editors.

As I wrote, and edited, and saw the interplay of features I was designing, the Guiding Principles began to emerge. Now that those are starting to form decisions are becoming easier because I can use them not only to guide those decisions, but to help understand why I want what I want.

The actual language…

…will have to wait for another post. This one enough on it's own, and there's a lot of syntax already designed.