From my perspective on Eiffel Loop, one of the most immediately memorable parts of Eiffel Loop that I wanted to try, but never could was the ZSTRING family of classes. Well, we have now arrived at the time where we get to build a fresh take on this library in modern Eiffel terms.
Wish me luck ... I'm goin' in!!!
---
---
## Pre-Flight Checklist
Before starting, confirm:
- [ ] Read `D:\prod\reference_docs\research\AI-slop\prompts\00_ANTI-SLOP-RULES.md`
- [ ] Read spec file `04_simple_string.md` (contains ZSTRING specification)
- [ ] Verify simple_encoding enhancements are complete (dependency)
- [ ] Confirm target directory exists or will be created
**Say this before starting:**
```
ANTI-SLOP RULES LOADED:
- No hypothetical results
- Evidence required for every claim
- Compile before document
- No imagined code behavior
- Document ACTUAL not EXPECTED
```
---
## WORKFLOW 1: Project Creation (Steps 1-10)
### Step 1: ANALYZE-REQUIREMENTS
**Action:** Extract contractual elements from spec file.
**Input:** Read `D:\prod\simple_loop\specs\04_simple_string.md`
**Output:** List of:
- Domain concepts (ZSTRING dual-storage, codecs, compact substrings)
- Required classes (~15 total)
- Key constraints
- Error conditions
**Classes to build (from spec):**
*ZSTRING Core (dual-storage architecture):*
1. SIMPLE_ZSTRING (main class - 8-bit primary + 32-bit overflow)
2. SIMPLE_READABLE_ZSTRING (deferred ancestor)
3. SIMPLE_COMPACT_SUBSTRINGS_32 (compacted Unicode storage)
4. SIMPLE_ZCODEC (abstract codec base)
5. SIMPLE_ISO_8859_15_ZCODEC (default Western European codec)
*String Utilities:*
6. SIMPLE_ZSTRING_SPLITTER
7. SIMPLE_ZSTRING_ESCAPER
8. SIMPLE_ZSTRING_EDITOR
9. SIMPLE_ZSTRING_FORMATTER
10. SIMPLE_ZSTRING_SEARCHER
11. SIMPLE_ZSTRING_BUILDER
12. SIMPLE_SUBSTRING_INDEX
13. SIMPLE_ZSTRING_OCCURRENCE_ITERATOR
14. SIMPLE_SPLIT_ZSTRING_LIST
15. SIMPLE_ZSTRING_TEMPLATE
**Verification:** List produced, no code written yet.
---
### Step 2: DEFINE-CLASS-STRUCTURE
**Action:** Create class skeletons with signatures only.
**Input:** Requirements from Step 1
**Output:** Create files:
```
D:\prod\simple_zstring\
├── simple_zstring.ecf
├── src\
│ ├── core\
│ │ ├── simple_zstring.e
│ │ ├── simple_readable_zstring.e
│ │ ├── simple_compact_substrings_32.e
│ │ ├── simple_zcodec.e
│ │ └── simple_iso_8859_15_zcodec.e
│ ├── splitter\
│ │ ├── simple_zstring_splitter.e
│ │ └── simple_split_zstring_list.e
│ ├── editor\
│ │ ├── simple_zstring_editor.e
│ │ └── simple_zstring_escaper.e
│ ├── format\
│ │ ├── simple_zstring_formatter.e
│ │ ├── simple_zstring_builder.e
│ │ └── simple_zstring_template.e
│ └── search\
│ ├── simple_zstring_searcher.e
│ ├── simple_substring_index.e
│ └── simple_zstring_occurrence_iterator.e
└── testing\
└── zstring_tests.e```
**Verification:** COMPILE
```bash
/d/prod/ec.sh -batch -config /d/prod/simple_zstring/simple_zstring.ecf -target simple_zstring_tests -c_compile
```
---
### Step 3: WRITE-PRECONDITIONS
**Action:** Add `require` clauses to all features.
**Output:** All features have preconditions.
---
### Step 4: WRITE-POSTCONDITIONS
**Action:** Add `ensure` clauses to all features.
**Output:** All features have postconditions.
---
### Step 5: WRITE-INVARIANTS
**Action:** Add class `invariant` clauses.
**Key ZSTRING invariants:**
- `area.count >= count` (8-bit storage always exists)
- `unencoded.is_empty implies not has_mixed_encoding`
- Codec consistency maintained
- Count synchronization between storage layers
**Verification:** COMPILE
---
### Step 6: IMPLEMENT-FEATURES
**Action:** Write feature bodies.
**Critical ZSTRING features:**
- Dual-storage management (8-bit + 32-bit overflow)
- `z_code` for accessing full Unicode code points
- `set_z_code` for setting with automatic storage selection
- Codec encode/decode for 8-bit representation
- `unencoded` access for 32-bit outliers
**Verification:** COMPILE
---
### Step 7: COMPILE-CHECK
**Action:** Fix any compiler errors.
**Verification:** Clean compilation.
---
### Step 8: RUN-CONTRACTS
**Action:** Run with assertions enabled.
**Verification:** RUN smoke test.
---
### Step 9: GENERATE-TESTS
**Action:** Write test cases.
**Test categories:**
- Pure ASCII (no overflow)
- Latin characters (codec-encodable)
- Mixed encoding (ASCII + emoji)
- Full Unicode (CJK, emoji, symbols)
- Codec boundary tests
- Memory efficiency verification
**Verification:** COMPILE + RUN
---
### Step 10: ITERATE-REFINE
**Action:** Fix issues until green.
**Verification:** All tests pass.
---
## WORKFLOW 2: Maintenance (Steps 11-18)
### Step 11: AUDIT-CONTRACTS (M01)
### Step 12: AUDIT-STRUCTURE (M02)
### Step 13: AUDIT-VOID-SAFETY (M03)
### Step 14: AUDIT-TESTS (M04)
### Step 15: ADD-MISSING-PRECONDITIONS (M05) - COMPILE
### Step 16: ADD-MISSING-POSTCONDITIONS (M06) - COMPILE
### Step 17: COMPILE-VALIDATE (M07) - COMPILE + RUN
### Step 18: TEST-NEW-CONTRACTS (M08)
---
## WORKFLOW 3: Maintenance Xtreme (Steps 19-28)
### Step 19: RECONNAISSANCE (X01)
### Step 20: VULNERABILITY-SCAN (X02)
### Step 21: CONTRACT-ASSAULT (X03) - COMPILE
### Step 22: ADVERSARIAL-TESTS (X04) - COMPILE + RUN
### Step 23: STRESS-ATTACK (X05) - COMPILE + RUN
### Step 24: MUTATION-WARFARE (X06)
### Step 25: TRIAGE-FINDINGS (X07)
### Step 26: SURGICAL-FIXES (X08) - COMPILE + RUN
### Step 27: HARDEN-DEFENSES (X09) - COMPILE + RUN
### Step 28: VERIFY-HARDENING (X10)
---
## WORKFLOW 4: Bug Hunting (Steps 29-36)
### Step 29: SURVEY-RISK-AREAS (H01)
### Step 30: ANALYZE-SEMANTICS (H02)
### Step 31: PROBE-EDGE-CASES (H03)
### Step 32: PROBE-STATE-SEQUENCES (H04)
### Step 33: PROBE-CONCURRENCY (H05)
### Step 34: CONSTRUCT-EXPLOIT (H06)
### Step 35: CONFIRM-ROOT-CAUSE (H07)
### Step 36: DOCUMENT-FINDING (H08)
---
## WORKFLOW 5: Bug Fixing (Steps 37-43)
### Step 37: REPRODUCE-BUG (F01) - COMPILE + RUN
### Step 38: CLASSIFY-FIX-LAYERS (F02)
### Step 39: FIX-SPEC-CONTRACT (F03) - COMPILE
### Step 40: FIX-CODE (F04) - COMPILE + RUN
### Step 41: VERIFY-FIX (F05) - COMPILE + RUN
### Step 42: VERIFY-NO-REGRESSION (F06)
### Step 43: ADD-REGRESSION-TEST (F07) - COMPILE + RUN
---
## WORKFLOW 6: Naming Review (Steps 44-51)
### Step 44: SCAN-VIOLATIONS (N01)
### Step 45: CLASSIFY-ISSUES (N02)
### Step 46: FIX-CLASSES (N03) - COMPILE
### Step 47: FIX-FEATURES (N04) - COMPILE
### Step 48: FIX-ARGUMENTS (N05) - COMPILE
### Step 49: FIX-CONTRACTS (N06) - COMPILE
### Step 50: FIX-MAGIC-NUMBERS (N07) - COMPILE
### Step 51: VERIFY-NAMING (N08) - COMPILE + RUN
---
## WORKFLOW 7: GitHub Prep (Steps 52-55)
### Step 52: GIT-INIT (G01)
```bash
cd /d/prod/simple_zstring
git init
git add .
git commit -m "Initial commit: simple_zstring library
ZSTRING dual-storage string implementation for memory-efficient
Unicode handling. Based on Eiffel Loop ZSTRING architecture.
Co-Authored-By: Claude Opus 4.5 <
nor...@anthropic.com>"
```
### Step 53: README-STANDARD (G02)
### Step 54: DOCS-STANDARD (G03)
### Step 55: FINAL-CHECKLIST (G04)
```bash
git remote add origin
https://github.com/simple-eiffel/simple_zstring.gitgit push -u origin main
```
---
## Completion Criteria
Library is DONE when:
1. All 55 steps completed
2. All tests pass
3. Published to GitHub
4. README and docs complete
5. ZSTRING dual-storage architecture verified working
6. Memory efficiency demonstrated vs STRING_32