Encapsulating your system through the file system

To a seasoned developer, the above sentence might sound like a Haiku. Something a computer might have generated automatically by following the rules of grammar, to create random sentences, incapable of communicating meaning. However, here’s an example of what I mean. Feel free to browse the “imp” folder to understand what I mean.

Hyperlambda has no namespaces, no classes, no private or protected keywords – Still, I’d argue it allows you to create much better encapsulation of your code. Simply since I can evaluate files as if they were functions. I can pass in arguments to my files, and do something resembling the following.

eval ("/backend/tickets/model/get-ticket.hl", id:5)

The above code is of course pseudo code, however its actual implementation is surprisingly similar in syntax. You can see it below. What it returns, is pretty obvious I assume.


Let’s use another example, how I build the toolbar in the top right corner of the system.

    class:strip themepark-top-buttons

It doesn’t require a rocket scientist to understand what that code does, or? Here is the folder it’s pointing to. If you take a look at one of its buttons, you’ll see something like this.

  innerValue:@"<span class=""icon-key""></span>"

Even without its comments, I believe most 10 year olds would instantly understand what the above code does. Below is a screenshot of what happens when I click the button. Notice, the screenshot below, including the button to trigger it, was created with no more than 9 lines of code.

Creating a new toolbar button, is as easy as creating a new Hyperlambda file, and putting it in the “/imp/common/toolbar-buttons/” folder. How many lines of code would you need to create something like the above in C#? Let’s try to imagine that as a thought experiment …

First we’d need support for dynamically loading up controls to populate our toolbar. This would probably require at least some 3-4 different design patterns, such as an Abstract Factory, Factory Methods, etc. Each button would have to implement some interface. Then we’d have to create some sort of JavaScript frontend part, allowing us to actually click the button, and creating an Ajax HTTP request, which does whatever the button does once clicked. A qualified guess would be.

  1. Factory methods and classes to dynamically populate toolbar ==> easily 300 – 500 lines of code
  2. Interface for buttons ==> probably 50 – 100 lines of code
  3. Each button’s C# file ==> between 50 and 500 lines of code, depending upon what the button does
  4. JavaScript to create our Ajax HTTP requests ==> At least 100-200 lines of code for each button

And we’d end up with a solution where even the smallest change in one of our parts, often would result in cascading effects, forcing us to change every single button, and every single part of our solution. For instance, adding another argument to our interface method results in having to change every single code file. Even with a conservative estimate, the above would result in 800 lines of code for three simple buttons – Possibly as much as 2,900 lines of code. I don’t think many seasoned developers would object to these numbers. If you don’t count the comments, the Hyperlambda equivalent becomes

  1. 3 lines of code for the toolbar
  2. 35 lines of code for all buttons

That’s 38 lines of code! Versus 800-2,900 lines of code. If we were to use our worst possible estimate from our C# solution, it would require 82 times as much code! Since the amount of cognitive energy you have to apply to a software project is directly proportional to the number of lines of code your solution contains, this results in that a pure C# solution would require possibly 82 times as much cognitive energy to be understood as its Hyperlambda equivalent. This translates into that if you require 5 minutes to understand the Hyperlambda code, you’d need almost 7 hours to understand the C# solution.

  1. Hyperlambda ==> 5 minutes, 38 lines of code
  2. C# ==> ~7 hours, 2,900 lines of code

All of these numbers I played around with here are numbers that most seasoned system developers could easily agree with me in regards to, so I cannot be blamed for having skewed the numbers in any ways. In addition to that purely mathematically the C# solution would require 82 times as much energy, it also contains 2 different programming languages (JavaScript and C#). On top of that, it contains several design patterns, to facilitate for creating a plugin architecture capable of dynamically loading buttons. Possibly some sort of configuration file (JSON/XML?) too, to declare which buttons you want to load. Hence, the C# solution would literally be scattered with dependencies, making even the tiniest change in any one of those files, possibly cascade into all 2,900 lines of code – Forcing you to effectively rewrite your entire solution, due to adding a single additional parameter to the instantiation of your buttons (style argument …?)

While for the Hyperlambda solution, all you’d have to do would be to change the [micro.widgets.file] invocation from above, to resemble the following.

  class:strip themepark-top-buttons

One additional line of code, compared to spending an entire afternoon rewriting interfaces and implementations. The above addition to my toolbar changed my buttons from this …

… to this …

It doesn’t take a rocket scientist to understand the advantage here … 😉

So while the C# developer is changing his interface to pass in style arguments to the instantiation of his buttons, editing literally every single code file in his solution, spending the better parts of an entire afternoon – Assuming he understands the code in the first place, and don’t need 5 days to simply understand the class hierarchy. I’ve moved on to the “next problem” literally after 2 seconds!!

Didn’t like my style argument? Well, OK – Let’s create an [onmouseover] event, that displays the title attribute in an “information bubble” window for our buttons.

  class:strip themepark-top-buttons

4 additional lines of code, and all of a sudden every single button in our toolbar displays something resembling the following when the mouse is hovered over the button.

How many hundreds or thousands of additional lines of C#/JavaScript/“whatever” do you think the above would need in literally any other traditional programming language …?

In case you didn’t like my above example, let’s do something more “hard core”. In fact, let’s invoke a web service, and let’s PGP encrypt our invocation and cryptographically sign our invocation. And just for the fun of it, let’s have the client supply the code that we evaluate on the web service endpoint. For then to have the web service verify the signature of our PGP key used to cryptographically sign our invocation, and allow specific PGP key signers to have “extended rights” during evaluation on our server.

 * Invoking web service, passing in Hyperlambda to
 * be evaluated on my server.
    .foo:This code was evaluated on the web service endpoint
      =:" "

8 lines of code. In fact, I am so certain about that you’d need thousands of lines of code to be able to do something even closely resembling the above in C#, that I am willing to bet a kidney on that you can’t without at least some 5-10,000 lines of C# code! 8 lines of code replacing 10,000 lines of code. That’s an increase of 1,250 times the cognitive load to implement the above in C#. And for the record, the above code is working code. If you download Phosphorus Five, you can immediately paste it into “Hypereval” and execute it. It will evaluate the code inside of its [lambda] node on my server for the record!

If it takes 5 minutes to implement the above in Hyperlambda, it would require 104 hours to do it in C#!

A seasoned software architect and software developer might laugh of Hyperlambda, proclaiming it’s not a “real” programming language, since it doesn’t contain x, y or z. However, none of that matters, because when somebody skilled enough to understand it puts themselves behind the controls of that thing, they’re doing warp 10, and have crossed half the galaxy and returned – Before the competition has even managed to start up his steam engines …

It has no wheels, no visible engines, and no gearbox – How can you claim it’s a vehicle …?

Well, since a picture is worth more than a thousand words, I’ll finish this article with a picture and a simple question …

How would you want to travel today Sir …?


Creating Hyperlambda from C#

I’ve just been refactoring and cleaning the code where I access my “auth” file in Phosphorus Five. The “auth” file contains the usernames/passwords and authorisation objects of Phosphorus Five. Since I am invoking Active Events parametrised from within these methods, I thought I’d take some time to explain this, since it provides an excellent use case of how to “create Hyperlambda” from C#.

The first thing you must realise about Hyperlambda, is that it’s simply a node structure. In fact, when your Hyperlambda has been parsed, its result is a simple graph object, encapsulated in the Node class of Phosphorus Five. This class contains lots of helper methods, but can be reduced down to the following pseudo code.

class Node {
    string Name;
    object Value;
    list Children;

The Children parts above is a list of Node children.

This trait of Hyperlambda, allows us to create Hyperlambda from C#. This might sound weird, but actually has lots of use cases. For instance, I wanted to encrypt my “auth” file when saving it, and decrypt it when loading it. I could of course have done this manually, by referencing BouncyCastle directly. However, I already have helper Active Events, that I can reuse, making my code much more condense, and allowing me to create more “DRY” code. DRY meaning “Don’t Repeat Yourself”. So what I ended up with was the following.

 * Implementation of saving auth file.
static void SaveAuthFileInternal (ApplicationContext context)
    // Getting path.
    string pwdFilePath = GetAuthFilePath (context);

    // Saving file, making sure we encrypt it in the process.
    using (TextWriter writer = new StreamWriter (File.Create (pwdFilePath))) {

        // Retrieving fingerprint from auth file, and removing the fingerprint node, since
        // it's not supposed to be save inside of the ecnrypted MIME part of our auth file's content.
        var fingerprint = _authFileContent ["gnupg-keypair"].UnTie ().Get<string> (context);

        try {

            // Writing fingerprint of PGP key used to encrypt auth file at the top of the file.
            writer.WriteLine (string.Format ("gnupg-keypair:{0}", fingerprint));

            // Encrypting auth file's content.
            var node = new Node ();
            node.Add ("text", "plain").LastChild
                .Add ("content", Utilities.Convert<string> (context, _authFileContent.Children))
                .Add ("encrypt").LastChild
                .Add ("fingerprint", fingerprint);
            context.RaiseEvent ("p5.mime.create", node);

            // Writing encrypted content to stream.
            writer.Write (node ["result"].Get<string> (context));

        } finally {

            // Adding back fingerprint to cached auth file.
            _authFileContent.Insert (0, new Node ("gnupg-keypair", fingerprint));

The above code is all the code I need to save my “auth” file, using a PGP key, stored in my GnuPG storage. Of course, if I was to use BouncyCastle directly, the above code would literally explode in size, and probably grow to at least one order of magnitude more in size. Instead I get to reuse my existing MIME Active Events, that allows me to simply supply a PGP key fingerprint, which will lookup my PGP key from my GnuPG storage, create a “text:plain” MIME envelope, encrypt that envelope, before it saves that encrypted envelope to disc. The thing you should pay particularly notice to above, is the parts where I construct my “node” object. The above code’s Hyperlambda equivalent would be the following.


Of course, arguably using a MIME envelope to serialise my auth file to disc, arguably creates some overhead. However, this overhead is a small price to pay for the simplified code. In addition it also allows me to easily extend my logic later, to for instance create multipart MIME envelopes, wrapping multiple auth files, encrypted with their own unique PGP keys. In addition to that it allows me to serialise binary data later into my auth file, etc, etc, etc. So the added overhead of constructing a MIME envelope wrapping my auth file, is really quite insignificant compared to its gains. Reading the file from disc and decrypting it, is equally easy.

 * Private implementation of retrieving auth file.
static Node GetAuthFileInternal (ApplicationContext context)
    // Checking if we can return cached version.
    if (_authFileContent != null)
        return _authFileContent;

    // Getting path.
    string pwdFilePath = GetAuthFilePath (context);

    // Checking if file exist.
    if (!File.Exists (pwdFilePath)) {
        _authFileContent = new Node ("").Add ("users"); // First time retrieval of "auth" file.
        return _authFileContent;

    // Reads auth file and decrypts it.
    using (TextReader reader = new StreamReader (File.OpenRead (pwdFilePath))) {

        // Retrieving fingerprint for PGP key to use to decrypt file.
        var fingerprintLine = reader.ReadLine ();
        var fingerprint = fingerprintLine.Split (':') [1];

        // Retrieving GnuPG key's password from web.config.
        var confNode = new Node ("", "gpg-server-keypair-password");
        var gnuPgPassword = context.RaiseEvent ("p5.config.get", confNode).FirstChild.Get<string> (context);
        // Retrieving the rest of the content of file.
        var fileContent = reader.ReadToEnd ();

        // Decrypting file's content with PGP key referenced at the top of the file.
        var node = new Node ("", fileContent);
        node.Add ("decrypt").LastChild
            .Add ("fingerprint", fingerprint).LastChild
            .Add ("password", gnuPgPassword);
        context.RaiseEvent ("p5.mime.parse", node);

        // Converting Hyperlambda content of file to a node, caching it, and returning it to caller.
        // Making sure we explicitly add the [gnupg-keypair] to the "auth" node first.
        _authFileContent = Utilities.Convert<Node> (context, node.FirstChild ["text"] ["content"].Value);
        _authFileContent.Add ("gnupg-keypair", fingerprint);
        return _authFileContent;

The above code will in a similar fashion to its save counterpart, decrypt my file with a handful of lines of code. Probably saving me hundreds of lines of code, compared to if I were to explicitly implement decryption instead. Its Hyperlambda counterpart would resemble the following.

 * Retrieving the password for our PGP key.

All in all saving me for hundreds, if not thousands of lines of code, allowing me to keep my code “DRY”, and reuse as much of my existing implementations as possible, without creating references between my two different projects. The last point is crucial. Because my auth file wrappers can be found in the project called “p5.auth”, while my MIME wrappers can be found in “p5.mime”. If you look at these projects in Visual Studio, you will notice that none of these projects have any references to the other, eliminating all the problems that such references might create, such as versioning problems, changing the signatures of my classes methods, etc, etc, etc. Resulting in a solution where I can reuse existing functionality from other projects, without any references between my projects at all!

I think that’s pretty cool! What do you think …?

Developing AND executing a C# console app from my phone

For years I have struggled with explaining people why we don’t need another platform for developing and distributing our apps than “the web”. In the meantime, developers were running over each other, like headless chickens, shouting “AppStore”, “Xamarin Forms”, “Android Market Place”, “Silverlight” and “God knows what”. Well, the shouting stops today. Everything besides “the web” is rubbish, regardless of what your “domain problem is”, unless you’re developing web browsers or drivers.

Can your favourite “x-platform toolkit” do the above? I have a web server running Apache and Linux. On top of that I have developed a web operating system, in C#, running on Mono. In this web operating system, one of 5 apps happens to be a web based IDE, allowing me to literally create C# Console apps from my phone, AND execute it after I have compiled it. Notice, I could also have created GO apps and Python apps for that matter using the same IDE.

If you want to send your money to Apple or Google, and let them control the distribution of your app – You are of course welcome to do that – But don’t come and tell me the reasons are because you can’t create what you want to create using “the web” – Because it’s simply not true! If you’ve got developers in your organisation telling you “The web is inferior, we’ll need to develop native apps” – Then send them a link to this article, and ask them; “OK, great! Can you create an IDE that allows me to do the above in a ‘native app’?”

You can download Phosphorus Five here – It’s 100% Open Source!

Hyperlambda, a better relational file format

XML, although its tooling space is really good, is simply too verbose. I’d argue that XML is so verbose it’s close to being unreadable by the human brain. JSON is better, but suffers from being too tied down to JavaScript, preventing you to (among other things) repeating the same key twice in the same scope. In addition, its syntax doesn’t make it easy to read, without providing tons of formatting to it. In its condensed syntax, JSON is also unreadable by the human brain.

YAML is really good. However, even YAML’s condensed syntax, is too much syntax. Besides, we need a simpler way to declare types. So I invented Hyperlambda. Yup, Hyperlambda is actually just a file format. And although its intrinsically tied to Phosphorus Five, there’s nothing preventing you from simply using it as a file format. Implementing your own parser to parse it is also dead simple – Assuming you don’t want to use my existing (Open Sauce) parser, which you can easily do, without using the rest of Phosphorus Five in fact. In fact, my existing parser is so simple, I didn’t even care to implement a tokeniser, since the format has only two distinct tokens. I think it’s roughly 1-200 lines of code. Below is an example.


The above illustrates 2 nodes, where the first node has two children. The name is to the left of the colon (:), and its value is to the right. So it’s a “name/value/children” file format. This structure happens to easily be able to describe anything that JSON, XML and JSON is capable of describing, only in a much more human readable format. In fact, it’s also a superior way to describe CSV content, since it also supports C# string literals. Below is an example.

foo:"This is a\r\nnew line"

In the above example, we have injected a CR/LF sequence,  allowing us to provide special characters, and even UNICODE literals, the same way we would in a C# string. It also supports multiline C# strings, such as the following illustrates.

foo:@"This is a
new line"

The above of course results in the exact same result as the previous example. And to make x-platform simpler, it *always* serialises a carriage return as a CR+LF sequence. Below is an example of creating a “CSV file”, using Hyperlambda syntax instead.

  name:Thomas Hansen
  name:John Doe

Slightly more verbose, but much more readable. And in fact, it also supports types. Below is an example that illustrates usage of types.

  name:Thomas Hansen
  name:John Doe

Notice the additional entity in between the “age” and its value, declaring the RHS value of “age” to be of type “int” ==> integer. If you’re looking for a simple to implement, and easy to read file format, for storing for instance your configuration settings, or other types of data – You might want to have a look at Hyperlambda. And in fact, you can use my existing parser, at which point you can simply invoke an Active Event, and have my parser do the heavy lifting, having returned a “Node” structure back to caller, that you can easily semantically traverse, almost the same way you’d traverse your XML DOM structure. Below is an example of invoking the Active Event that parses a Hyperlambda string for you.

var node = new Node ("", "your-hyperlambda-goes-here");
var nodeResult = someApplicationContextObject.RaiseEvent("hyper2lambda", node);

The above would make your “nodeResult” contain the nodes from your Hyperlambda, having tons of supporting methods and properties, such as “LastChild”, subscript operator to retrieve children nodes, etc, etc, etc. And in fact, it even allows you to comment your nodes, using C#/Java comments if you wish. Below is an example …

 * This is a record.
  // This is the name of the record.
  name:Thomas Hansen
  name:John Doe

Hyperlambda, a scripting language for .Net and C#

Imagine if you could dynamically “orchestrate” your C# plugins and libraries together in a dynamic environment. What would this do for you? Kind of like a “FoxPro plugin” for C#? Something that would allow you to keep all the advantages of C#, yet still have a dynamic scripting language at your disposal?

Well, you don’t have to wait. This is the purpose of Hyperlambda. I wrote an article about Hyperlambda in MSDN Magazine last year, and it actually became one of the top 5 most read articles in the Magazine’s history – So obviously this is something C# developers were waiting for.

The thing about Hyperlambda, is that it allows you to dynamically “mold” CLR assemblies, classes, and methods together, by injecting Yet Another Layer Of Abstraction (YALOA) in between your C# code, and the parts that “configures” your apps together. In a way, it allows you to “configure” your apps, with a syntax resembling that of YAML. So you get to keep all the advantages of C#, including those 10,000 + Open Source .Net libraries at GitHub – Yet still having all the advantages of a dynamic environment, such as PHP or JavaScript, allowing you to orchestrate your apps together, in a dynamic “scripting” environment. Hyperlambda is not intended to replace C#, quite the contrary – It lives in symbiosis with C#, although I tend to use some strong superlatives about OOP every now and then … 😉

In fact, Hyperlambda serves as a bridge; A bridge between the client and the server, a bridge between your C# code and your app, and a bridge between a statically compiled programming language (C#), and the dynamic environment of JavaScript. It becomes the equivalent of the “grease in your car engine”, that allows all of your car’s parts to function smoothly, without things getting stuck to each other, destroying your car.

A month from now, I will get the opportunity to illustrate exactly what this can do, and its benefits. Simply because a month from now, I will enter in front of a live audience, and “compete” with a static and traditional programming language called Lily, and such hopefully illustrate just how much of an advantage having a little bit of “grease” in your car’s engine actually can give you.

If you’d like to be notified, feel free to subscribe to my blog. The event will be properly marketed, and I will announce it here on my blog when we have a date – At which point you can see me compete with a “traditional OOP (only) solution”. In this competition, both of us will be given the same specification, and asked to solve it as fast as possible. The winner is the first guy to finish. If you can’t wait another month, please realise that the following web based IDE was exclusively built using Hyperlambda. Not a single line of C# code was written to create it …

Hyper IDE contains 2429 lines of code, it was built in roughly 2-3 months, by one guy (me), and it contains 649 comments. Its initial page load bandwidth consumption is roughly 100Kb, and it loads on my phone. Hyper IDE supports some 100+ programming language, and I will obviously exclusively use Hyper IDE in the competition, if I can …

I wish my opponent good luck, and may the best man win … 😉

The World Heavy Weight Programming Championship contest is GOING DOWN!

FascinatedBox has accepted the terms put forth by one of the moderators over at ShittyProgramming, and Cal (moderator) is as we speak trying to find a date for the event. This implies that in the near future, you will see a shake-down between Lily and Hyperlambda, where we will be given a specification for a software system, which we are to implement. None of us will have seen the specification before entering “the ring”, and the idea is to implement it faster. The one who finishes first, becomes the winner, and the loser is banned from the Reddit group called “shitty programming”.

The event will be streamed live, and I will publish the date, time and the URL, from where you can follow the event *live*, once I have it. Any profits from the contest will be given to charity.

May the best man win!

OK, let’s DO this!

Some guy posted a link to Phosphorus Five and Hyperlambda over at Reddit, in a group called “shitty programming”, implying Phosphorus Five was rubbish. Normally I wouldn’t care about it, if it hadn’t been for the fact that this guy has created his own programming language. As I defended myself and Hyperlambda, I arguably became a little bit “emotional”, so the moderators over at this group, decided to solve the problem. However, instead of banning both of us, which is what they usually do – They have decided to organise a “boxing match” between me an the guy behind the other language. Read their invitation to me below …

I’m game, and I’ll invite all of my friends to watch, and I’ll try to get some media attention around this, inviting Channel 9, MSDN Magazine, and others to stream it live, internationally! The loser will be banned from posting at the group in the future – Implying the winner will basically have “monopoly” on talking shit about the other guy’s programming language on Reddit in the future. I wish “FascinatedBox” good luck.

May the best man win!

The bridge from C# to JavaScript – Hyperlambda

Imagine if you could easily invoke C# methods from JavaScript, and easily invoke JavaScript functions from C#. The main purpose of Hyperlambda is to serve as a bridge between JavaScript on the client, and C# on the server. Among other things, it allows you to declare your HTML markup, with a syntax similar to YAML. From your Hyperlambda, you can easily declare DOM event handlers on your HTML elements, that invokes your C# methods on the server when raised. Imagine the following code.

  innerValue:Click me!

I assume you don’t need a PhD in computer science to understand what the above code does. Then combine the above Hyperlambda with the C# method created in the video below.

This simple trait, allows you to bridge your server side C# with your client side JavaScript, without having to create complex JSON serialisation and de-serialisation functionality yourself. And, it reduces the size of the client side JavaScript library to 5.7KB, giving you a lot of room to add your own JavaScript …

Check it out here

Hyperlambda, a human2computer communication interface

How does your computer feel today?

I have just been in a very interesting email conversation with a renowned senior researcher and scientist. Since I am not entirely certain about whether or not she wants to bring our communication into the public space, I will avoid disclosing who she is. However, our communication illustrates a very good use-case for what I like to refer as the “hard computer literacy problem”.

The researcher I have been communicating with, is a native French speaker, while I am a native Norwegian speaker. Obviously, if we communicated in our native tongues, we would not be able to understand each other. Hence, a common interface between myself and the other party needs to be established – English does a decent job at this!

The same problem exists between computers and humans. Humans understands spoken and written words, while computer understands only computing instructions – And the gap between these two very different mental frameworks, leads to huge communication problems. It doesn’t matter if you exchange “machine instructions” with whatever programming language on the planet here either, since the gap between any current computer language, and any existing human language, is simply to great for most people to be able to engage in a meaningful communication with a computer, to communicate their “intentions”.

Hence, the results becomes that of, only roughly 2% of the population in the western hemisphere, are capable of “communicating with computers”. Which creates an “illiterate gap” between “those who know” and “those who don’t know”. Arguably the same problem as Europe faced in the 15th century in regards to general literacy, before Gutenberg’s invention of the printing press, commoditised the Bible, facilitating for everybody learning how to read the Bible themselves. Needless to say obviously, but the effects of this, made the very concept of power become significantly much more evenly distributed, facilitating for the Enlightenment, modern science, and Democracy, etc.

Linguistics, the framework of the human mind, and the foundation of civilisations

However, if you break down “communication” into its abstract parts, you realise that there’s actually a lot of common ground we can rely upon, to communicate in a much more natural and intuitive way, with our computers. For instance, most sentences have a verb, a noun, etc. The verb might be “move”, the noun might be “car”. OOP was supposed to solve this. Unfortunately, OOP is complicating matters, instead of making things simpler. Hyperlambda though, due to its relative naive structure, seems to perfectly solve this problem though. Below is an example of a piece of Hyperlambda, which might look like pseudo code, but could easily be implemented such that it becomes *actual working code*.


Notice, I want to emphasise that the above is *not pseudo code*! Still, understanding what the above Hyperlambda would do if evaluated, is so simple that it wouldn’t even require explanation to make a child understand it. Compare the above Hyperlambda with the OOP equivalent.

ICar vehicle = Factory.Find ("my-car");
IAction action = AnotherFactory.CreateAction (Action.Move);
action.SetSubject (vehicle);
IPosition pos = YetAnotherFactory.CreatePosition ();
pos.SetSource (Locations.Work);
pos.SetDestination (Locations.Home);
action.Parametrise (pos);
action.Execute ();

You don’t need to be a rocket scientist to understand how one of the above examples are much more easily understood. And you don’t need many years of OOP to realise that the above description of how to perform some simple action with an object in OO, is a highly realistic description of the necessary pre-requisites for being able to even communicate a simple thing, such as moving an object from one position to another position.

An early version of written language, too arcane to be understood by anyone but a few elect members of “the elite”. Just like programming languages are today.

In fact, if anything, I’m willing to bet most OO programmers would perceive my above usage of OO as naive, compared to what they have often had to implement, to create “SOLID” code themselves.

Even ignoring the parentheses, semicolons, object decorations, and cohesion problems – The OOP solution is still “Greek” for most people. While the Hyperlambda solution can be intuitively understood, by everyone having nothing but basic understanding of English.

For a “human 2 computer” interface, Hyperlambda is simply superior. Sure, you can understand how to “communicate” with a computer today, if you spend some 10 years studying some dark and mystical programming language – But why is this necessary …?

Why can’t we use the existing rules of Linguistics and natural language, to find a common ground for communication between computers and humans …?

Why is it necessary having to spend half our lives, before we can create basic programming instructions, communicating our intentions to a computer? I can easily tell a human being to “please turn off the lights before you leave home tonight”. If I asked a computer illiterate to tell their computer the same thing, they’d freeze, unless another software developer had already created a “button” to allow for such an action. Which leads us to the following question …

How many buttons should we have in our software systems?

To communicate ANYTHING to any other human being, requires only 26 “buttons” (the Latin alphabet and a keyword), still most human beings can use those 26 buttons to communicate an infinite amount of different permutations of intentions. So why does my WordPress dashboard have ~1,000 different buttons? It cannot even do 0.0001% of what I can do, using natural speech, or a keyboard with 26 characters.

In fact, the above Hyperlambda example is so close to natural language, that I have taken the liberty of creating a bridge between computers and humans, which allows you to literally speak natural English to your computer, and have the computer evaluate computing instructions as a consequence – Effectively even eliminating the need for even being literate to become a “computer programmer”!

Hyperlambda web service invocations

A Hyperlambda web service, is a web service that allows a client to securely supply an algorithm, or a “lambda object”, which the server will evaluate on its side, and (optionally) return the results of its evaluation back to the client. This completely reverses the responsibility between the “client” and the “server”, and allows for a whole range of really interesting scenarios, arguably facilitating for that your machines can engage in a “meaningful semantic discussion”, communicating intent back and forth, the same way two human beings can. Watch the video below for a demonstration.

If you make sure you have the latest version of Hypereval and Phosphorus Five, you can reproduce what I did above with the following code. Copy and paste this code into Hypereval, then save it and make sure you save it as a “page”.

 * Creates an example page, which allows the caller to invoke a lambda web service,
 * passing in his own Hyperlambda to be evaluated.

     * Including Micro CSS file, serious skin, and fonts.

              class:bg shaded rounded air-inner air-top
                  innerValue:Invoke lambda web service

                 * Hyperlambda editor, which allows user to supply his own Hyperlambda.

                 * "Save button" and URL textbox wrapper.
                  class:strip fill

                     * URL textbox, for where we should pass in the specified Hyperlambda.
                      placeholder:Web service endpoint URL ...

                     * "Invoke" button.

                         * Serializes our form, and invokes the specified web service endpoint, passing
                         * in the specified Hyperlambda.

                         * The actual invocation to the web service endpoint.

                         * Creating a modal widget, displaying the results of our invocation.

When you have saved the above Hyperlambda as a “page”, click the “play” button in Hypereval to preview your page. Then paste in the following code into the CodeMirror editor on your page.


Then make sure you supply the following URL in the URL field.


And click “Invoke”.

What is happening here, is that your client is serialising your Hyperlambda, for then to pass YOUR CODE TO MY SERVER. My server will evaluate your Hyperlambda, with a small subset of my server’s Active Events as its legal whitelisted “vocabulary”.

If you try to invoke an Active Event which I have not explicitly whitelisted, my server will throw an exception, and prevent your code from being executed on my server. This effectively allows two servers to **SECURELY** communicate code, logic and intentions back and forth, the same two (intelligent) human beings are capable of …

When two human beings are engaging in a dialogue, what we are actually doing to some extent, is not merely communicating data back and forth. We are in fact also passing on algorithms to the other party. A great example is “remember to turn off the lights before you leave home”. Depending upon what relationship the receiver of these “algorithms” have with the sending party, he might choose to execute the “algorithm” that the sender gave him. Hyperlambda Web Services allows computer to do the same. As far as I know, this has never been securely done before, throughout the history of computing. However, feel free to prove me wrong if you can.

Additional steps can also be easily implemented, to further secure these invocations, such as demanding the client to have cryptographically signed the MIME message containing the Hyperlambda, for then to create a whitelist of PGP keys that are allows to invoke web services, the code can be encrypted, etc, etc, etc. Below is the code for the web service endpoint.

 * Creates a lambda Web Service endpoint.

 * Sanity checking invocation.
  p5.web.response.set-status-description:405 Only POST method is allowed
  p5.web.echo:Only HTTP POST requests are allowed in here ...

 * De-serialising request.

 * Evaluating specified Hyperlambda in a "whitelist" invocation to [eval].
 * Notice, whatever keywords you wish to allow your clients to be legally allowed to evaluate,
 * must be declared in the [events] lambda below.

 * Yielding results of above evaluation back to client.
<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>