Tag: programming languages

When To Use Smart Pointers

You could very easily go crazy with smart pointers. It seems like the safe idea, until you realize that you could be tying up memory everywhere. Perhaps you handle them carefully to avoid that issue. A more pressing problem is the mess of code they require to use them, such as is the case if you template your smart pointer class. Even if you are ok with that, your compiler might not be. GCC, for example, has a bug that won’t let you nest templates within each other. Usually you have to create some sort of wrapper class around a template. That makes accessing the data even more tedious.

Continue reading “When To Use Smart Pointers”

Interpreted vs Compiled

There’s a bit of disagreement over what is an “interpreted language” and what is a “compiled language”. Technically, you would think that any language that can be interpreted by a virtual machine can also be compiled even if with great difficulty. I can’t speak for every language out there, and I haven’t gone over all the considerations to come to any sort of definitive conclusion about the matter, but I am inclined to think that it is possible to invent a programming language that cannot be run as native code.

Continue reading “Interpreted vs Compiled”



I like languages. Latin, German, French, and more recently devoted to Japanese. Programming languages are my favorite however. They are so powerful: the perfect tools for creativity and symbolic expression. Beautiful code is like a well-written poem: Short, simple, efficient, but clearly understandable to someone even moderately acquainted with the words and grammar.

Being that I enjoy languages, I’ve peaked at and toyed with a bunch of programming languages from Clojure to Python. It’s exciting to see new ones arise (though I am alittle tired of JavaScript-based stuff). I wanted to make my own. The journey started a very long time ago, but I rediscovered my fascination with creating languages about 7 or so years ago when (like my young programmers) I wanted to build a self-improving neural network. I knew that in order for such a system to work, I needed to write a programming language that could rewrite itself. Silly idea, but as I wrote my first language interpreter, I became so obsessed with the creation that I abandoned my AI project and focused primarily on completing my language. Some 4000 lines of code later, I had created a mess known as “Goldfish”. It worked. It had if-statements, while-loops, math functions, custom functions, and variables that saved strings. Libraries could be loaded, provided they were in the same folder. The interpreter could also do things like read the next (or previous) character in the file, skip character processing, move variables up from lower stack contexts and do a number of other things it didn’t really need to do, all with the help of keywords. Overall, it was fast but very limited and very messy. (Conveniently enough, by the time I took a programming languages course in college, I already knew most of the concepts, having tried them or considered them after I made a mess of code. I prefer to call that “learning by doing” rather than “learning the hard way”, but to each their own.)

Tossing Goldfish aside at version 8.2.2, I tried again, this time resorting to a much more object-oriented approach. After pouring lots of work into that, I realized my paradigms were too willy-nilly and my memory management system was not going to work. I abandoned this as Goldfish 10 and tried to forget about creating a programming language… ever again.

A deep-felt desire never dies. Within a few years and armed with an extensive amount of experience, I was back to contemplating the idea again. I wrote my ideas down in several small text files scattered around my computer. The clockwork in my head just wouldn’t quit processing this problem.

Eventually, I discovered (or rather, rediscovered) Rust, which fulfilled many of the ideas that I learned would work. I was elated, but that was short-lived. For one thing, the paradigms that Rust requires for safe programming would greatly limit my power as a programmer. For the things I wanted to do, I needed pointers, as much as I hate them, and trying to use them in Rust would have been very difficult. More importantly, Rust was compiled, and therefore could not be embedded. While you can certainly mix Rust with other languages, it isn’t as easy as I’d like. Thirdly, Rust is verbose, and not in a more readable way like Java. There is no prettier language than Java to me (notable bias from me working with C++ most of the time), but admittedly, Rust is not as bad as it could be.

With Rust scratched from contention, the only other language I wanted to turn to was Python. To say Python is awesome sounds like an understatement to a fan like me, but it does have some notable design shortcomings, even now that Python 2.7 has Unicode support. For one, there is the horrible null value (known simply as “None”). Such a value has been called the “billion dollar mistake” (referring to its presence in Java, but it’s the same issue), and while it persists in many languages (except Rust) in different names (“null”, “nil”, “none”, etc.), it is still a problem that leads to security holes. Furthermore, working with C code requires dealing with raw memory allocation. I could handle references safely in C++, but integrating Python with C++ is anything but convenient.

I didn’t quit searching for alternatives, mind you. I looked at weird small languages like AngelScript, Jx9, and ChaiScript, among others. Nothing had quite what I wanted. Pike may have been the best candidate (if it were still around). JavaScript did have quite a few things I liked, but (among other oddities) it had some funny syntax issues and, like Python, had the problem of loops and a garbage collector. Getting away from all the stuff that has plagued other languages was going to be a real challenge.

Despite the years of setbacks (but excellent learning experiences) and the incredible challenge of writing everything from scratch AGAIN (and linking it up with existing engines and writing hooks for interaction with other languages and writing documentation and… and… and…), I just can’t seem to step away from this dream. So, I’m trying again. At the very least, I’m going to get some blog articles out of this!! Fortunately for you, my reader, I actually have several things written down and quite a bit already coded up.