Share code between pointer types
This authored build-demand planner is not a compiler/linker or a code-size measurement. Commands are one per line: call <fn> <type>, uses <fn> <callee> in Medium/Hard, plan, and plan shared in Hard. Function/base-type names match [A-Za-z_][A-Za-z0-9_]*; a type token is a base name optionally prefixed by one * or &, and ptr is reserved for the shared-body marker. These are opaque planner categories, not native Go/Rust/C++ type syntax: &str here shares under the model rule, without claiming that a real Rust string-slice reference is a thin pointer. All uses edges forward the exact same type token. Edges/calls accumulate in input order; duplicate edges and cycles are allowed; every plan recomputes a fresh report over everything declared so far. Depth-first first-demand order is part of the report contract. At most 32 distinct functions, 16 base types, 128 calls, 128 edges, 16 plans and 256 ASCII command lines, each at most 8192 bytes; ordinary I/O/allocation completes. Bare plan keeps exact pairs; shared groups * and & tokens per function while retaining every exact function/type dictionary demand. The model does not include real compiler type substitution, GC maps, method-set analysis, wrappers, optimization or machine-code emission.
What needs to change
Change nameFor so plan shared lets pointer types share code.
Reproduce
- Run the sample: the C++ program reads calls to show with *Order, *User and i32, then plan shared and plan. Compare every line.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
record and instantiate are supplied. nameFor receives the Plan and can record into plan.dictionaries. The lab compiles with g++ -std=c++23.