DEV Community

Cover image for Is Hyperlambda a "toy programming language"
Thomas Hansen
Thomas Hansen

Posted on • Originally published at aista.com

Is Hyperlambda a "toy programming language"

It's easy to dismiss Hyperlambda as a "toy programming language". It's got no classes, zero OOP, barely any typing, and it feels like YAML. However, that misses the point, because its simplicity is what makes it powerful. If you were to classify Hyperlambda on the index of low versus high level programming languages, it would make stuff like VB6 and FoxPro resemble Assembly. This is its strength too. To understand why, look at the following chart.

Complexity measurement of modules in Aista

What you're looking at above, is actually all of Aista's's middleware. Roughly 7,000 lines of code, and that's it. Still, with these 7,000 LOC we are able to serve our entire infrastructure. This implies being able to create and destroy cloudlets from our hub, having subscription based payments, registering users having them verify their email address, sign up people for our newsletter, serve plugins to Magic cloudlets, calculating affiliate earnings, etc, etc, etc. Basically we're running our entire company on 7,000 lines of code. The rest of our code is either off the shelf server infrastructure components, or frontend Angular code.

I can't show you the code, since this is a part of our secret sauce, and what gives us value as a company - But I can show you some general Hyperlambda snippets. For instance, as you're creating a new cloudlet in our hub, you'll have your cloudlet's name populated by a default animal name, such as tiger, lion, eagle, etc. This is 3 lines of code in Hyperlambda.

auth.ticket.verify:guest, root, admin
io.file.load:/modules/hub/magic.startup/misc/animals.json
return:x:-
Enter fullscreen mode Exit fullscreen mode

The first line verifies the user is authenticated to invoke the endpoint, and the next two lines loads a file and returns its content as JSON to the caller.

What you don't see in the above Hyperlambda

The stuff you don't see, is that the file will be loaded async, the user will be verified using JWT bearer tokens, the HTTP response will automatically be determined to be JSON, etc, etc, etc. There's practically zero difference between the above Hyperlambda, and the equivalent 50+ lines of code you'd have to write in C# to accomplish the same. The performance is also the same. And speaking about performance, the above snippet probably performs at least one order of magnitude better than its PHP or Python equivalent. What I want you to take away from this though, is the following.

We built our entire company with exclusively Hyperlambda code ...

... and, we're a cloud service provider, needing subscription based payments, invoicing, ticketing and support systems, notifications, creation and destruction of cloudlets, dynamically installing plugins in said cloudlets, etc. What problem could you possibly have that is more complex than the above? We basically built AWS, Google or Azure if you wish, and we built it exclusively with Hyperlambda.

Outperforming Google, Azure and AWS with 7,000 LOC

Yup, we basically outperformed all of the above with nothing but 7,000 lines of Hyperlambda code. How you may ask? Because not only do we provide all the basics that the above provides when you want to "build an app", but we also provide it in such a way that the machine creates 80% of your code. The next time you're coding in Hyperlambda and somebody asks you what you're doing, do me a favour please, and answer the following ...

I'm just outperforming Google with a toy programming language ^_^

Even though Hyperlambda "feels" like a toy programming language, I can guarantee you that it is not. If you want to see exactly how much we achieved with these 7,000 lines of code, feel free to create a free demo cloudlet below.

Top comments (0)