0xMiden/miden-vm

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

开放

#2,687 创建于 2026年2月13日

 (2 条评论) (0 个反应) (0 位负责人)Rust (303 个派生)github user discovery
documentationgood first issue

仓库指标

星标
 (753 个星标)
PR 合并指标
 (平均合并 6天 2小时) (30 天内合并 71 个 PR)

描述

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 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.:

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

贡献者指南