Commit 10841190 authored by Dario Pinto's avatar Dario Pinto
Browse files

1 article + update

parent fa18ef8e
title=Announcing Liquidity version 1.0
authors=Alain Mebsout=
date=2019-03-08
category=Blockchains
tags=liquidity
# Liquidity version 1.0
We are pleased to announce the release of the first major version of the Liquidity smart-contract language and associated tools.
Some of the highlights of this version are detailed below.
### Multiple Entry Points
In the previous versions of Liquidity, smart contracts were limited to a single entry point (named `main`). But traditionally smart contracts executions path depend strongly on the parameter and in most cases they are completely distinct.
Having different entry points allows to separate code that do not overlap and which usually accomplish vastly different tasks. Encoding entry points with complex pattern matching constructs before was tedious and made the code not extremely readable. This new feature gives you readability and allows to call contracts in a natural way.
Internally, entry points are encoded with sum types and pattern matching so that you keep the strong typing guarantees that come over from Michelson. This means that you cannot call a typed smart contract with the wrong entry point or the wrong parameter (this is enforced statically by both the Liquidity typechecker and the Michelson typechecker).
### Modules and Contract System
Organizing, encapsulating and sharing code is not always easy when you need to write thousand lines files. Liquidity now allows to write modules (which contain types and values/functions) and contracts (which define entry points in addition). Types and non-private values of contracts and modules in scope can be accessed by other modules and contracts.
You can even compile several files at once with the command line compiler, so that you may organize your multiple smart contract projects in libraries and files.
### Polymorphism and Type Inference
Thanks to a new and powerful type inference algorithm, you can now get rid of almost all type annotations in the smart contracts.
Instead of writing something like
```ocaml
let%entry main (parameter : bool) (storage : int) =
let ops = ([] : operation list) in
let f (c : bool) = if not c then 1 else 2 in
ops, f parameter
```
you can now write
```ocaml
let%entry main parameter _ =
let ops = [] in
let f c = if not c then 1 else 2 in
ops, f parameter
```
And type inference works with polymorhpism (also a new feature of this release) so you can now write generic and reusable functions:
```ocaml
type 'a t = { x : 'a set; y : 'a }
let mem_t v = Set.mem v.y v.x
```
Inference also works with contract types and entry points.
### ReasonML Syntax
We originally used a modified version of the OCaml syntax for the Liquidity language. This made the language accessible, almost for free, to all OCaml and functional language developers. The typing discipline one needs is quite similar to other strongly typed functional languages so this was a natural fit.
However this is not the best fit for everyone. We want to bring the power of Liquidity and Tezos to the masses so adopting a seemingly familiar syntax for most people can help a lot. With this new version of Liquidity, you can now write your smart contracts in both an OCaml-like syntax or a [ReasonML](https://reasonml.github.io)-like one. The latter being a lot closer to Javascript on the surface, making it accessible to people that already know the language or people that write smart contracts for other platforms like Solidity/Ethereum.
You can see the full changelog as well as download the latest release and binaries [at this address](https://github.com/OCamlPro/liquidity/releases).
Don't forget that you can also try all these new cool features and more directly in your browser with our [online editor](https://www.liquidity-lang.org/edit/).
......@@ -8,8 +8,6 @@ let old_to_new =
; ("/fr/recrutement-ocamlpro/", "/jobs")
; ( "https://www.ocamlpro.com/pre-inscription-a-une-session-de-formation-inter-entreprises/"
, "/" )
; ( "https://www.ocamlpro.com/2019/03/08/announcing-liquidity-version-1-0/"
, "/" )
; ( "https://www.ocamlpro.com/2019/03/09/release-liquidity-v1-smart-contracts-language/"
, "/" )
; ( "https://www.ocamlpro.com/2019/08/30/ocamlpros-compiler-team-work-update/"
......@@ -218,6 +216,8 @@ let old_to_new =
, "/blog/2019_03_05_techelson_a_test_execution_engine_for_michelson" )
; ( "/2019/03/05/signing-data-for-smart-contracts/"
, "/blog/2019_03_05_signing_data_for_smart_contracts" )
; ( "/2019/03/08/announcing-liquidity-version-1-0/"
, "/blog/2019_03_08_announcing_liquidity_version_1_0" )
; ("/2019/04/10/opam-2-0-4-release/", "/blog/2019_04_10_opam_2.0.4_release")
; ( "/2019/04/29/blockchains-at-ocamlpro-an-overview/"
, "/blog/2019_04_29_blockchains_at_ocamlpro_an_overview" )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment