1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-11 03:35:37 +03:00
nickel/cli
Yann Hamdaoui 18ee89b644
Split contracts into an immediate part and a delayed part (#1975)
* Add immediate/delayed notion to the manual

* Split custom contracts in immediate and delayed part

This commit explicitly split the custom contract representation and
constructors into an immediate part, similar to a validator, and a
delayed part, which is a partial identity. The stdlib and primops are
adapted as well (`%contract/custom%` now takes two arguments, the two
parts, and `%contract/from_xxx%` operators aren't used anymore as they
are subsumed by `%contract/custom%`).

* Rework prepare_contract to be more low-level and use null comparison

* Make `%contract/get_xxx%` panic on a Type

In the long run, we want that `%contract/get_immediate%` and
`%contract/get_delayed%` works as well on types, by calling to the right
function from the internals module. However, this requires deeper
changes, and is left for future work. Since those primops have just been
introduced, there's no reason they'd be used already in the wild, so for
now, we make the implemention panic if we try to apply them to a Type.

* Update stdlib doc, manual and examples

Update various documentation to reflect the new custom contract
constructor with an immediate and a delayed part.

* Update config-gcc example with new custom contract builder

* Fix tests

* Implement review suggestions

Co-authored-by: jneem <joeneeman@gmail.com>

* Review suggestion: use concrete example for delayed checks

* Review suggestion: deduplicate custom contracts in-code doc

* Update Topiary input to avoid CI error (gitsavannah)

---------

Co-authored-by: jneem <joeneeman@gmail.com>
2024-07-03 09:38:00 +00:00
..
src Fix clippy 1.75 warnings (#1750) 2024-01-07 17:32:34 +00:00
tests Split contracts into an immediate part and a delayed part (#1975) 2024-07-03 09:38:00 +00:00
Cargo.toml Add span information for TOML imports (#1949) 2024-06-12 08:12:39 +00:00