{{announcement.body}}
{{announcement.title}}

Hyperlambda - Probably the coolest .Net Core Programming Language in the World

DZone 's Guide to

Hyperlambda - Probably the coolest .Net Core Programming Language in the World

In this article I walk you through the basics of Hyperlambda, which is a generic DSL created for .Net Core, with some amazingly cool features

· Web Dev Zone ·
Free Resource

Even if you're not even interested in the automatic CRUD possibilities that Magic gives you, choosing it simply because you need a DSL engine for .Net Core, should probably be enough arguments for you to want to check it out for your enterprise software development requirements. Previously Hyperlambda has suffered from extreme lack of documentation, but today I released a huge new release of the the goods, where one of its most important features is just that - Documentation.

So what is Hyperlambda. Well, instead of me waiving my arms around, arguably trying to explain what a UFO is to a cavemen, let's have the thing speak for itself. Because I guarantee you that you have never ever ever seen anything even closely resembling it, and I also guarantee you that you will be amazed by it.


The first thing you will notice in the above video, is that I am capable of writing code into my browser, using a "fully fledged code editor", arguably a micro IDE, for then to simply click a button, and transmit that code to my server, where my code is executed - And the entire process doesn't require more than a handful of milliseconds in total. Hence, the following can be said about Hyperlambda with confidence.

  1. It's 100% dynamic in nature, not requiring any compilation at all.
  2. It's blistering fast, allowing me to dynamically create code, pass the code to my server, execute the code on the server - And still the code is (almost) as fast as a conventional managed C# method.
  3. It is extremely easy to extend and modify using C#, or any other CLR based programming language.
  4. Its tooling space is flabbergastingly cool, with things such as snippets, integrated documentation, CodeMirror based autocompletion and syntax highlighting editors for writing code from your browser, etc, etc, etc.

So what is it?

Actually, I'm glad you asked - Because it's literally just text, in a relational file format, kind of like XML or YAML. This happens to have a lot of advantages over other conventional programming languages, such as giving you the ability to dynamically traverse the entire "execution tree" structure, modify it, and read it, as you are executing it. In such a regard, it is not similar to anything you have ever seen before. The closest you'd probably come, is probably YAML or XML+XSLT+XPATH. However, also such a comparison becomes shallow, as you're trying to understand it. So let me show you some Hyperlambda.

Plain Text
 




x
19


1
/*
2
 * Example of how to retrieve emails form a POP3 server.
3
 */
4
mail.pop3.fetch
5
   server
6
      host:pop.gmail.com
7
      port:int:995
8
      secure:bool:true
9
      username:gmail-username@gmail.com
10
      password:Gmail-Password
11
   max:int:50
12
   raw:bool:false
13
   .lambda
14
      /*
15
       * Some lambda object invoked once for every email fetched.
16
       * Given message as [.message] node structured as lambda.
17
       */
18
      lambda2hyper:x:..
19
      log.info:x:-


The above piece of Hyperlambda, will connect to your POP3 server, assuming you change its credentials, fetch all new emails, maxing out at 50, for then to invoke the [.lambda] node as if it was a "function", and execute this function once for every single email retrieved.

This above [.lambda] of course, simply creates a log entry, containing your entire email, including its headers and such - But exchanging it with something storing your emails into some database of course, implies simply changing some 5-10 lines of code. Hence, 30-50 lines of code maybe at the max, and you've arguably implemented the bulk parts of Gmail. Then add the above code semantically into something like the following ...

Plain Text
 






... and you've created a scheduled task, that will execute every 25 seconds, that will retrieve all new emails from your POP3 account as it executes.

Even imagining how to build the above in C# would probably require several PhDs in Computer Science, not to mention that its implementation would probably end up being thousands of lines of code. The above is combined, including comments, exactly 30 lines of code. Let me know in the comments section here if you want me to write more about Hyperlambda, and go beyond the 101s. And let me know if there are some particular Hyperlambda slots you'd want me to implement for your needs.

Thank you for reading me, have a nice day :)

Topics:
.net, .net core

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}