0xMiden / 0xMiden/miden-vm

docs: document `word("...")` string constructor for word constants

Offen
#2,687 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation good first issue
Vorherrschende Sprache
Rust
Sterne
772
Forks
352
Ø Merge
1 T. 12 Std.
Gemergte PRs (30 T.)
93

Beschreibung

## Summary

The `word("...")` syntax for deriving a Word constant from a string hash is widely used (especially for named storage slot IDs) but is not documented in the assembly reference.

## Details

The [code organization docs](https://docs.miden.xyz/design/miden-vm/user_docs/assembly/code_organization#word-constants) document word constants declared as arrays (`[1,2,3,4]`) and hex values, but not the `word("string")` constructor.

This constructor is used extensively in miden-base and tutorials, e.g.:
```masm
const METADATA_SLOT = word("miden::standards::fungible_faucets::metadata")
push.METADATA_SLOT[0..2]
exec.active_account::get_item
```

## Suggestion

Add a subsection to the "Word constants" section in `docs/src/user_docs/assembly/code_organization.md` explaining:
- The `word("string")` syntax and what it computes (deterministic Word from string hash)
- Common use case: named storage slot IDs with `[0..2]` slice notation

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.