Thank you for following the latest in Tezos smart contract language development! We’re introducing two new Tezos smart contract languages in this installment: SCaml and Archetype.
Let us know if you have:
- feedback or suggestions
- a language you would like to add
Recent development
Archetype
The Archetype team worked on preparing the next release: 0.1.13
-
Reorganized tests with more than 220 unit tests (previously ~50 tests).
-
Implemented the ‘rational’ type. Rational values enable easy formulation of computations, like percentage and ratio. For example, in the following snippet, the exec action transfers 20% of the transferred amount to the argument address
dest:archetype rational_rat_tez_mult action exec (dest : address) { effect { var m = 0.2 * transferred; transfer m to dest } }It is transcoded to
amount div 5wheredivis the euclidean division. -
Implemented the
durationtype. Duration values are used to compute dates by addition/subtraction of a duration to a date. In the following snippet, the exec action transfers if current date is one week afterlast_execdatearchetype rational_duration variable last_exec : date = 2020-01-01 action exec (dest : address) { called by admin effect { if now > last_exec + 1w then ( last_exec := now; transfer transferred to dest ) } }
LIGO
The LIGO team is making its way towards a more mature compiler:
-
Refactoring the AST to turn some built-in cases into functions. The more expressive the type system, the more cases we can turn into functions, and the less cases there are, the easier it is to modify the compiler. The new typechecker helps as it slowly passes more and more tests.
-
Improved the documentation by rewriting a large chunk of it and automatically testing the examples in the docs. Experience tells us these can quickly get out of sync, and the CI is more proactive in noticing errors than we could ever be.
-
Working on an interpreter for LIGO independent of the Michelson backend, to be able to unit-test LIGO code directly in LIGO.
-
Error messages are improving everywhere: after the work on the current typer’s error messages, we’re just starting work on propagating source locations and other info to know where errors come from in the new typer. The ReasonLigo parser errors are also being improved. Finally, some lexical checks have been added for duplicate constructors or record fields, use of reserved words as identifiers, etc.
-
An
[@@inline](in CameLIGO, and[@inline]in ReasonLIGO) annotation was added, it indicates that a function should be inlined at its call sites
Better task management:
-
Increased visibility for issues that need review from multiple people
-
Developing new processes so intentionally delayed tasks are not forgotten
In the larger context of the community:
-
we have worked on making Tezos more efficient (investigation in gas pricing, storage and amendments)
-
we’re preparing for the WebAssembly summit and for upcoming training at Nomadic Labs on February 12th (https://training.nomadic-labs.com/training.html).
SCaml
-
The first Docker image of SCaml is out at https://hub.docker.com/repository/docker/dailambda/scaml. It’s still simple but you can try SCaml easily by running:
$ docker run dailambda/scaml:1.0.3 scamlc xxx.ml -
Implemented the type-checking of classes of types (such as comparable, packable, storable, and parameterable) in SCaml so that invalid uses of comparisons, closure creations, contract storages and parameters are detected at SCaml level.
-
Added
--convertand--revertoptions toscamlccommand to convert and revert SCaml values to Michelson values. -
ML types are converted to Michelson types now with annotations of record field names and variant constructor names. For example, the following ML type definition:
type config = { title : string ; beginning_time : timestamp ; finish_time : timestamp } type action = | Vote of string | Init of configis converted to the following Michelson type, with
%-annotations:(or :action (string %Vote) (pair :config %Init (string %title) (pair (timestamp %beginning_time) (timestamp %finish_time))))This makes the output Michelson code easier to read, especially for deciphering the structure of storages and parameters.
SmartPy
The SmartPy team has continued working on
-
the testing framework
-
decompilation
-
new constructions to handle lambdas
-
inter-contract communication
Thanks for reading, and check back soon for our next update!
Eowyn on behalf of the LIGOlang team