2026-02-06 19:31:38 -07:00
|
|
|
# Building a Cache - Whetstone AST (Canonical Form)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Function: getOrCreate
|
Sprint 3 plan and docs: adopt canonical annotation system from annotations/Memory strategy.md
- Add Sprint 3 plan (37 steps, global 39-75) with canonical memory annotations,
test quality requirements, global step numbering, and Sprint 2 overlap notes
- Refactor all docs to use canonical annotation families (@Deallocate, @Lifetime,
@Reclaim, @Owner, @Allocate) replacing simplified @deref 4-strategy system
- Replace @perf with canonical @Hot/@Cold, @Inline, @Pure from annotations/6 optimization
- Replace @memory-footprint, @execution-mode, @deref-explicit with canonical equivalents
- Update REQUIREMENTS_OVERVIEW, SPRINT_1_REQUIREMENTS, SPRINT_2_PLAN, SPRINT_2_VISION,
C++ Implementation Roadmap, example files, and progress report
- Remove duplicate bonus steps 41-42, consolidate Phase 3h from 7 to 4 steps
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 08:11:23 -07:00
|
|
|
@{MemoryAnnotation} // One of: @Deallocate(Explicit), @Lifetime(RAII), @Reclaim(Tracing), @Owner(Single), etc.
|
2026-02-06 19:31:38 -07:00
|
|
|
Parameter: cache -> Map<string, Widget>
|
|
|
|
|
Parameter: key -> string
|
|
|
|
|
Body:
|
|
|
|
|
IfStatement:
|
|
|
|
|
condition: key in cache
|
|
|
|
|
then: Return cache[key]
|
|
|
|
|
else:
|
|
|
|
|
Assignment: widget = Widget.create(key)
|
|
|
|
|
Assignment: cache[key] = widget
|
|
|
|
|
Return: widget
|
|
|
|
|
```
|