Saturday, February 28th, 2009

In my search of various langauges I have stumbled upon Clojure.  It meets a lot of the criteria established in the last post.

I am ashamed to say I have not learned a Lisp dialect up until this point.  I have known enough about Lisp to get the concept but never actually used it for anything.  The fact that it isn’t commonly available on servers nor common to set up caused me to shy away from it. The thought process going on in my mind was probably: Why bother learning something that I’m not really going to be able to use? It’s just an intellectual curiosity. Well, now I have good reason to learn it.

I bought the Pragmatic book Programming Clojure and like what I have learned so far. This language / environment has a lot of what I have been looking for.

It runs in the JVM so you have full access to any library that is available in Java. Moreover, it is often more convenient to access these libraries in Clojure than they are in Java. It can be embedded into any server architecture that runs the JVM. I haven’t looked into this step but I imagine it is pretty easy to get up and running on a server.

It has all the benefits of Lisp like homoiconicity and macros.

It takes great steps towards Intentional Programming. Since code is data you are not restricted to working with source code in some kind of lexical form. You can use tools that will output the code for you and compile it into JVM bytecodes on the fly and behind the scenes.

There’s much more that can be elaborated on but I think you get the picture. I definitely recommend checking the language out. You can find out more at the web site

Language Goals

Sunday, February 8th, 2009

I have been giving some thoughts on what an ideal language would be like and have come up with the following list.

Flexibility.  There is no one ideal language.  Design, like many other fields, has always been about deciding between 2 alternatives.  What is good in one instance may be horrible in another.  Therefore, flexibility is important to make the language fit to the task.  This means there are mulitple ways of doing things.  It also means you can build the language up to the task.  Lisp and Forth based languages are commonly programmed in this manner.  To achieve this goal I believe the language will need to be circular and homoiconic.

Simplicity.  The most elegant solutions are usually the simpliest as well.  This could be thought of as the RISC of programming languages.  Again, languages like Lisp are known for their simplicity.  There is very little syntax to learn and yet it is very expressive and powerful.

Support for meta programming.  I’m not sure if this should be built into the language or if the flexibility of a language will automatically allow for it.  The latter would be more elegant.  Often when programming I find myself doing the same thing over and over again.  So called design patterns are often just artifacts of a language that doesn’t allow you to express your intent succintly.

Homoiconic.  This basically means the language data structures of the language are the language itself.  Lisp and Factor have this in common.

Multi-fix Syntax.  Postfix, prefix, infix should be allowed whenever it is most convenient to do so.  Each programming task may be written better in one of these forms.  The language should not be restricted to only 1 of them.

Dynamic Syntax.  This goes along with flexibility.  You should be able to configure the langugae / environment that best fits the task at hand.  Perhaps this means lots of languages in one (all of them homoiconic and sharing the same code contsructs internally).

Intentional Programming.  I’m not going to define what this is here.  You can google it to find out more about it.  The basic idea I want to borrow from it is that programming should not be about text only code.  You should be able to use tools and construct tools to create what you need.

Macros.  This may or may not be needed depending on how usable the langugae is already.  I need to spend more time working with Lisp to really understand how they are used and if they should be adapted to my language.

Interpreted.  There is tremendous flexibility and power when a language is interpreted.  Many things are simplified.  Speed and code security are the obvious drawbacks.

Runs inside common environments.  PHP, Javascript, Actionscript, and Java are the languages of the web.  If the environment is built to run inside these environments you gain all the API from them.  It is also much easier to deploy and distribute to others if you have a kernel that can easily be installed without any sysadmin work.  This will allow products to be sold without the need of complex environment requirements.

Mix environment with code.  I’m thinking of Squeak, the Factor listener, and Intentional Programming here.  Programming should not be about working with text only.  Often this is the only way it is done.  There is no reason why it needs to be that way.  There is much to be gained if we allow an environment to directly access the constructs of the language directly.