Optional dot syntax for anchored keys (#423)

This commit is contained in:
Andrew Twyman 2025-09-11 12:23:46 -07:00 committed by GitHub
parent f95a27b412
commit 7e04eb51ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 18 deletions

View file

@ -12,10 +12,13 @@ some of its arguments is proved, it means that a valid Merkle proof of the
value behind it exists and was used at some point to construct a `Contains`
statement that introduced that anchored key.
In PODLang, anchored key indexing can use subscript syntax `foo["bar"]` which
allows any string key, or dot syntax `foo.bar` if the key is a valid identifier.
For example:
```
0: None
1: Contains(foo, bar, 42) <- ContainsFromEntries 0 0 0 mt_proof
2: Lt(foo[bar], 100) <- LtFromEntries 1 0
3: NotEqual(foo[bar], 100) <- LtToNotEqual 2
1: Contains(foo, "bar", 42) <- ContainsFromEntries 0 0 0 mt_proof
2: Lt(foo["bar"], 100) <- LtFromEntries 1 0
3: NotEqual(foo.bar, 100) <- LtToNotEqual 2
```

View file

@ -59,7 +59,7 @@ Equals(a, c)
First, we need to decompose all the anchored keys as (dict, key) pairs. This is the frontend description of the deduction rule.
```
IF
Equals(a_or[a_key], b_or[b_key)
Equals(a_or[a_key], b_or[b_key])
AND
Equals(b_or[b_key], c_or[c_key])
THEN