Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document let blocks on templates #5908

Merged
merged 1 commit into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/source/daml/code-snippets/Reference.daml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ template NameOfTemplate
exampleParam : Text
-- more parameters here
-- end template params snippet
-- start template sigs snippet
-- start template let snippet
where
let
allParties = [exampleParty, exampleParty2, exampleParty3]
-- end template let snippet
-- start template sigs snippet
signatory exampleParty
-- end template sigs snippet
-- start template obs snippet
Expand Down
5 changes: 5 additions & 0 deletions docs/source/daml/reference/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ template body

Can include:

:ref:`template-local definitions <daml-ref-template-let>`
``let`` keyword

Lets you make definitions that have access to the contract arguments and are available in the rest of the template definition.

:ref:`signatories <daml-ref-signatories>`
``signatory`` keyword

Expand Down
14 changes: 14 additions & 0 deletions docs/source/daml/reference/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ Template parameters

.. Template has an *associated* data type with the same name?

.. _daml-ref-template-let:

Template-local Definitions
**************************

.. literalinclude:: ../code-snippets/Reference.daml
:language: daml
:start-after: -- start template let snippet
:end-before: -- end template let snippet

- ``let`` keyword. Starts a block and is followed by any number of definitions, just like any other ``let`` block.
- Template parameters as well as ``this`` are in scope, but ``self`` is not.
- Definitions from the ``let`` block can be used anywhere else in the template's ``where`` block.

.. _daml-ref-signatories:

Signatory parties
Expand Down