How do you go about doing that?
And now your language is already doomed to obscurity. What? Already? That’s not very fair! Let me explain why.
Inspired by someone I know who did design a rather successful programming language, I thought it would be the coolest thing to design an even better language. Because I’m hubristic like that, I guess. I’m pretty sure he won’t mind.
But I have realized that a programming language is a tool more than it is a work of art. Art can be created for its own sake. Tools must be created for a purpose. If the single thing you want do is to create a programming language, that will determine the nature of the language you create. It will probably be a beautiful language. And it will be useless for any real programming. So nobody will use it except those few people who are interested in art languages. Humans are good at working toward a purpose; your end result will reflect your purpose.
Oh, but if you want to create an actually useful language, you don’t have to give up on that. To do that, you have to find a purpose for it, and pretend that was why you wanted to make the language all along. Humans are good at pretending.
Humans are also good at becoming what they pretend to be. In many of my other projects, I’ve had to wrestle with the problems presented to me by the underlying language. This is natural for a programmer, of course; no tool is perfect in every way. I’m sure some if not most programmers have dreamed of creating their own language at some time or other. Most of them are content enough to stick with what they’ve got. A few get frustrated enough to attempt to create their own language. A few of those succeed. I hope to be one of them.
So, what will be the purpose of my programming language? To be multi-purpose, of course!
Right, right.
In order to make a good tool you need to think of a more concrete goal than that. I can imagine some wise person saying "In order to design for everyone, you must design for yourself." Well, it may not be strictly true, but being my own customer does ensure that my product is useful to at least someone. As large as this world is, there are probably people with the same needs as me, who could use my language.
So clearly, to be as relevant as possible, I need to be as needy as possible.
So here is the need I have come up with. It happens to match well with my other programming hobby. I want to create a video game with my programming language.
But there are already plenty of game-oriented languages out there, right? Not exactly. Those other languages like GML or Squirrel or Lua or ActionScript are scripting languages, made for the high-level specification of events that happen in a low-level engine that was written in C++ or something. I want my language to provide for every part of the system. Including, hopefully, the design process. So, to sum up my long-term plans, the language needs to:
- Wrangle complicated data around at compile-time, like polygon shapes, item specifications, room specifications, tilemaps, etc.
- Allow for easily writing up stateful actor logic.
- Connect to C and C++ libraries for OpenGL and a physics engine (if I don’t write the latter myself).
- Produce an executable that is fast and efficient, and allow one to make a main loop that performs no dynamic memory allocations, to attain realtime performance (I have this going in C++ and it is pretty fun to work around this constraint).
- Let me create an IDE that serves as a level editor and image editor, and lets me manipulate various kinds of data as both code and WYSIWYG, using both a CLI and a GUI which is itself modifiable. Features like copying and pasting data and undoing will be implemented on the language level.
Now that you see it, you can admit that this list is much more daunting than the stated purpose of "game programming" would lead you to believe. In fact, these requirements are already beyond any other programming language I know of. Oh hey, just for good measure, let’s add in another insane requirement, though it’s kind of unrelated:
- The core of the language should be flexible enough to compile to weird things like Javascript. Not all the core features will be available there, of course (such as file IO and unboxed types), but those that are can be taken advantage of.
How on earth is the language going to do all those things, some of which are completely incompatible? The keyword is as above: flexibility. Flexibility in letting the core provide slightly different features in different environments, and in letting the programmer sandbox themselves into a more restricted system with a modified core. Believe it or not, I have fairly concrete ideas on how all of these things can work together and form an elegant language in the end. You’ll see more specifics here in the months and years to follow. [Edit on 2013-10-19: Definitely years.]
You are skeptical of my ambition, I can tell. I am approaching this as a constraint-solving puzzle, and it is definitely the largest puzzle I have ever taken on in my life. I have been thinking about it for two whole years already. Only now am I confident enough in my designs to show some of them off in public. This is a form of art that I am choosing to dedicate much of my time to.