Files
hakorune/docs/private/roadmap/phases/phase-20.22/PLAN.md

32 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Plan — Phase 20.22String/Array CABI / MVP
マイルストーン
- M1: string → C コピー APIhako_string_to_c_copy
- M2: array<i64> → C コピー APIHakoArray / hako_array_to_c_copy
- M3: ヘッダー生成拡張typedef/プロトタイプ)
- M4: スモークC リンク実行・負例)
タスク詳細
1) String copyout
- 実装: 内部 StringBox から bytes を複製、末尾 NUL を付与
- 戻り: char*caller owns; `hako_free` 必須)
- 失敗: NULL 返し安定タグstderr
2) Array<i64> copyout
- 実装: 配列メタlenを読み、`HakoArrayI64{data,length}` を複製
- 戻り: HakoArrayI64*caller owns; `hako_mem_free(data)``hako_mem_free(self)` 必須)
- 失敗: NULL 返し+安定タグ
3) ヘッダ生成
- `typedef struct { int64_t* data; size_t length; } HakoArrayI64;`
- プロトタイプを c_header_gen.py に追加
4) スモーク
- C からリンク: 文字列/配列を受け取り、値確認→`hako_free`
- 負例: 空文字列len=0NULL 入力巨大サイズFailFast
リスク/対策
- 二重解放 → `hako_free` の多重呼び出し検知Fail
- 競合 → Phase 20.21 の retain/release ルールに従う
- ABI 拡張 → _copy と _borrow を命名で分離(本フェーズは _copy のみ)