Cicero v0.5.0
Pre-releaseMomentum is building π ! We're really starting to see the benefits of the stack now.
This week's release includes support for Cicero in the browser, support for module import in Ergo, and an external contribution from @dlkconsultancy to provide a contract Car Rental template in Turkish, teΕekkΓΌr ederim! πΉπ·
Note that we plan to support multi-locale templates (with legal text in multiple locales, backed by a common data model and logic) in a future release. See issue #174.
π Beware that we have some breaking changes in this release on the Ergo side, but don't worry, the migration is pretty simple (accordproject/ergo#326)
Install the latest release of the Cicero command-line tool with
npm i -g @accordproject/cicero-cli
Features
Cicero
π Cicero is escaping from the server into the browser! This opens up all sorts of fun possibilities, Cicero Template editing online, client-side validation of templates. We're really excited to see where this leads. HT @mttrbrts
<script src="https://unpkg.com/@accordproject/[email protected]/umd/cicero.js"></script>
See the following minimal repos for examples that use the webpack'd library.
- Using the CDN version of Cicero - https://github.com/mttrbrts/react-cicero
- Bundle the module yourself - https://github.com/mttrbrts/webpack-cicero
Ergo
π Ergo is now at v0.2.0.
πΈ Delegate!! Ergo 0.2.0 supports modularity: you can create your logic in multiple Ergo files or import libraries! For instance:
// In money.ergo:
namespace org.accordproject.ergo.money
define function compoundInterest(annualInterest : Double, numberOfDays : Double) : Double {
return (1.0 + annualInterest) ^ (numberOfDays / 365.0)
}
// In logic.ergo:
import org.accordproject.ergo.money.*
...
clause check(request : Payment) : Result throws ErrorResponse {
let compounded = request.amount * compoundInterest(contract.interestRate, numberOfDays);
...
Language
- Module system for Ergo. Logic can be split in multiple module and imported.
- Instead of
new Concept{ ... }
we now write:Concept{ ... }
(accordproject/ergo#326) - Fully qualified names prefixed with
~
to avoid parsing ambiguity (accordproject/ergo#310) - New syntax to set contract instance and call clauses (accordproject/ergo#277)
Compiler
- Brand new inlining phase (contribution @kach)
- Revisions/bug fixes to namespace resolution and context management
- Compiler and REPL share common compilation pipeline
- Automatically reorders input CTOs and Ergo modules based on dependency
- Initial compiler support for type checking
Tooling
- new
ergodep
command line tool calculates dependencies
REPL (contribution @kach π―, @jeromesimeon)
- Interface improvements (multiline input, better error reporting, handles empty input gracefully)
- Support for state changes
- Support for
match
,set contract
andcall
REPL now checks/infers types (alpha)
Document Object Model
πΆ Eating our own dog-food... @dselman has published a DOM (document-object model) to describe the structure of a Cicero template. This formal structure gives us much more power to parse, generate and manipulate templates within the engine and using Ergo code.
Get a sneak peek of what's to come at https://models.accordproject.org/cicero/dom.html and by following the issue #171.
Templates
π Car Rental Agreement (in Turkish) via @dlkconsultancy. This is the first non-English template, great job Umut and Serkan!
Documentation
See the latest version of the documentation at https://docs.accordproject.org/
Fixes
π Something screwy happened with our version numbers but @jeromesimeon & @penguinbroker put us back on track! (215e3da)
π The cicero-core API now exposes the TemplateLibrary
class properly (2469c1d)