Commit 2af2ece
authored
docs: Candid spec reference (#69)
## Summary
- Type system: all primitive types (bool, nat, int, nat8/16/32/64,
int8/16/32/64, float32/64, text, blob, null, reserved, empty, principal)
with Motoko/Rust/JavaScript mappings table
- Constructed types: `opt`, `vec`, `record`, `variant` — field hash
formula, tuple shorthand, idiomatic patterns
- Reference types: `func` (query/composite_query/oneway annotations),
`service`, type definitions, mutual recursion, imports
- Service description grammar: full BNF with service constructors
(InitArgs pattern)
- Subtyping rules: covariant results, contravariant arguments, option
rules, record/variant evolution, safe-upgrade patterns table
- Binary encoding: DIDL magic bytes, type opcode table, LEB128/SLEB128
summary
- Language mappings: consolidated table across Motoko/Rust/JavaScript
with edge-case notes
- `didc` tool: check, bind, encode, decode, subtype, hash commands with
examples
## Sync recommendation
informed by `dfinity/candid` — `spec/Candid.md`; informed by
`dfinity/portal` — `docs/references/candid-ref.mdx`,
`docs/building-apps/interact-with-canisters/candid/candid-concepts.mdx`1 parent 6b1b688 commit 2af2ece
1 file changed
Lines changed: 455 additions & 10 deletions
0 commit comments