Skip to main content

The ultimate programming language ?

After many years of thought and many years of using many languages, I am now more and more convinced that the “perfect” combination, if such a thing exists, is going to be a mix of Haskell, LISP and Prolog.
Exactly what “combination” means in terms of the different programming paradigms each presents is completely unknown to me at this point! Haskell is functional, Prolog is logical and LISP is everything.

LISP

First of all, the uniform s-expression shape of LISP is so absolutely pure, clean and simple that I feel it’s the true shape of expressing thoughts as code. If you work in LISP long enough you don’t even see the parens any more. Really. And the implied return value being the last thing you did is also useful.

Haskell

Haskell is incredibly clean in its form. The use of a space character as the argument separator is cool. The functional aspect is also very very nice. What I don’t like about Haskell is the IO / monad thing, Sometimes it feels incredibly hard work to do things within the context of other things, pardon the pun but sometimes there’s just too much heavy lifting!

Prolog

Finally, Prolog. We all know about predicate logic, true or false. There is something so clear and obvious about Prolog rules… that the rule is true if and only if every single sub-rule is true. The first version of Erlang was written in Prolog, and when I learned that I suddenly realised why the syntax of Erlang is like it is, it made Erlang much more readable for me.

Commonality

Haskell and Prolog both offer pattern matching; once you understand and get used to the idea of extracting “if” tests out of the code and making them separate clauses, your code becomes much clearer and easier to read and reason about. LISP doesn’t have pattern matching per se but it does have multi-methods, something I am sure no other language yet offers at all (I could be wrong) and this from a language created back in the 1950-s! John McCarthy and his students did something truly amazing indeed.


So, what’s the ideal? The future is on highly concurrent and scalable systems. So functional programming is more than likely the way forward for lots of reasons to do with not passing around state and the ability to perform map-reduce optimisations on functions just by deductive reasoning on what it does, or more importantly, doesn’t do: rely on external state.

Compilers are getting smarter, we need to keep up!

I am going to think about this more actually, and maybe design an “ivory tower” conceptual language and throw it out there…

Comments

Popular posts from this blog

The Coolest Shortest PHP Function I Will Ever Write

Having now released my own programming language, FELT , and learned a lot about this and that in the process I have of late, in the evenings, been struggling to reconcile my love of LISP and how simple FELT makes some PHP coding task leaner and meaner with the fact that I still have to use PHP for my day job. In my language, FELT , I have used the square brackets to define a "normal" array and curly braces to define a "key-value" array, mainly because this is identical to JSON format and anybody familiar with Javascript coding just won't have any issues getting to grips with that now will they! Let's take some simple examples of FELT code: (defvar simple-array [1 2 3 4]) (defvar simple-map {:name "Eric" :age 42 :occupation "Viking Hacker"}) When FELT has done its thing, we get the following PHP code, $simple_array = array(1, 2, 3, 4); $simple_map = array('name' => "Eric", 'age' => 42, ...

Handling multipart/form-data with NanoHTTPD

I am in the process of reviving an old project from 2014 that I never finished because of other work commitments. In that time, bitrot has set in, the Android API has moved on and all in all, the home-brewed HTTP server I wrote using SocketServer and the org.apache libraries had to go! I looked around, found a couple of contenders and after much time decided to go with NanoHTTPD because it is lean, small and fits in exactly two files. The main server is in one file `NanoHTTPD.java`and there is another file called `ServerRunner.java` which manages instances of running servers. The others The other project I looked at is this one:  https://github.com/koush/AndroidAsync which led me a merry dance and I just couldn't figure out how get the POST data I had uploaded. I spent a few days really digging at it with Wire Shark too to make sure the data was going up. It was. Whatever... I had used it via a gradle dependency entry but I dropped it and went back to NanoHTTPD. For m...

Using a RAM disk with Opera on OS X

Having recently configured AndroidStudio to use a RAM disk for Gradle, I thought I would look around and see if I can use the remaining space for Opera. This is essentially a reproduction of this fine page: http://www.ghacks.net/2010/10/20/how-to-change-the-opera-cache-directory/ That page does not deal with Macs though and after a little bit of experimentation I came up with this spell: open /Applications/Opera.app/ --args --disk-cache-dir=/Volumes/RamDisk/opera For the record, here is my Opera version: Make sure that the specified folder exists before starting Opera, if might automatically create the folder for you but I didn't bother to find out, I hate disappointment. And for the record, the way I create a RAM disk on my iMac, which is done automatically when I log in, is like this: diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://4194304` The above line was courtesy of this YouTube video: Thanks to Bartech TV then! So, with Turbo m...