Why Should you Learn the Leo Programming Language

Written by kaylej | Published 2023/01/03
Tech Story Tags: aleo | leo-lang | leo | learn-to-code-leo | learn-to-code | programming | software-development | coding | hackernoon-es | hackernoon-hi | hackernoon-zh | hackernoon-vi | hackernoon-fr | hackernoon-pt | hackernoon-ja

TLDRLearning a new programming language is common to hardened developers. The average programmer can get up to speed in 3-4 weeks, and can often learn 2-3 new languages in a year. Is Leo worth your attention? How promising is it? Let's find out.via the TL;DR App

Learning a new programming language is common to hardened developers. The average programmer can get up to speed in 3-4 weeks, and can often learn 2-3 new languages in a year. Is Leo worth your attention? How promising is it? Let's find out.

The Leo language is very similar to Rust

Leo is a statically-typed programming language built for the Aleo blockchain. You can build private applications in a fully private decentralized blockchain using it, basically Solidity but for Aleo.

Let's compare the syntax of the simplest mathematical operations:

An example of a simple program for Leo:

Same for Rust:

As we can see, both languages have about the same syntax, but they differ significantly in the input-output structure. While in Leo we can integrate variables from a separate inputs file, in Rust you can't do this by default (you can only do it if you describe the import file manually). This is due to the structure of the Aleo blockchain — it's focused on anonymity, and developers felt that inputs should be described in a separate file. Try it for yourself:

https://play.leo-lang.org/ <- online compiler for Leo

https://play.rust-lang.org/ <- online compiler for Rust

Let's take a quick run through the basics of Leo:

Leo supports the let and const keywords for defining variables.

let defines a dedicated program variable.

const defines a constant program variable.

Constant variables do not define a variable in a constraint system. Their value is constrained in the schema when computing with the allocated variable. constant variables cannot be changeable. They have the same functionality as Rust.

Calculations are expressed in terms of R1CS arithmetic circuits. Thus, calculating a selected variable always results in another selected variable.

Variability

All variables in Leo are immutable - they cannot be changed after the assignment, just like in Rust. All variables in Leo are modifiable - they can be changed after the assignment. Variable functionality is not preserved in different areas because Leo variables are passed by value.

Static typing

Leo is a language with static typing, which means that we must know the type of each variable before executing the schema.

Explicit types are required.

There is no undefined or null value in Leo. When assigning a new variable, the type of the value must be explicit. An exception to this rule is if the new variable inherits its type from a previous variable.

Value passing

Variables in Leo are always passed by value, which means that they are always copied when used as input to a function or in assignments.

Boolean values

Leo supports traditional tuples or boolean values. Adding an explicit boolean type for boolean values in statements is optional.

Integers

Leo supports signed integers i8, i16, i32, i64, i128 and unsigned integers u8, u16, u32, u64, u128

Integers with higher bit lengths create more restrictions in the scheme, which can slow down the calculation time.

From the above, we can conclude that learning Leo will not take much time for Rust developers. However, the question for Aleo developers is, "How can we encourage developers to switch from Rust to Leo?" Since experienced builders are in demand, the project puts high stakes on the line. There is an Aleo grant program for this purpose:

Grant Program for Outstanding Developers

In order to encourage qualified developers to join Aleo, the project has launched a grant program:

https://www.aleo.org/post/community-grants-program

Developers can ask for up to $100,000 for their work. However, the higher the amount of money requested, the higher the level of work required. Here's an example of some of the grant program winners:

Pine Street Labs: https://www.aleo.org/post/aleo-grants-pine-street-labs - basically is a wallet software builder.

Partnership with Forte: https://www.aleo.org/post/aleo-announces-partnership-with-forte - game developing (Not really a grant recipient since it’s not a startup)

Now let's compare the average income of an advanced Rust developer:

Let’s take a look at indeed.com:

On average, a Middle-Senior Rust developer can earn up to $150,000 a year (both Blockchain and Web2 examples). How much more (or less) than what can be earned at Leo? No one knows, but you can certainly expect a high salary since the Leo developer labor market is obviously not the most competitive. Most developers I know are feeling comfortable building their own things, such as NFT collections or DAOs, and so can you. You still can earn while being self-employed. More precisely, it's not competitive at all - you can become one of Leo's first programmers right now!

Where to start? Learning Leo is not the hardest task, because the current project's enthusiasts are already doing a great job preparing to educate materials for Leo! Just visit the official Aleo Discord channel to look for translations in any language: https://discord.gg/aleohq

Also, you can start learning with official Leo docs: https://developer.aleo.org/leo/language

Good luck in your endeavors!


Written by kaylej | Aleo Ambassador
Published by HackerNoon on 2023/01/03