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

37 lines
1.6 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.

# Phase 20.22 — String/Array CABIMVP / P1: Deferred unless FFI required
前提
- Phase 20.21 完了CABI メモリ管理の SSOT が確立)。
目的FFI用途
- C 側へ安全にコピーアウトする最小 API を提供(所有権=呼び出し側)。
- from_cビュー借用は扱わず、読み出し専用で進める。
ステータス
- セルフホスト優先のため P1後回し。FFI が必要になった時点で着手する。
APIMVP
- 文字列(読み出し専用)
- `char* hako_string_to_c_copy(HakoHandle str);`caller owns; `hako_mem_free` 必須)
- 配列i64 限定の最小)
- `typedef struct { int64_t* data; size_t length; } HakoArrayI64;`
- `HakoArrayI64* hako_array_i64_to_c_copy(HakoHandle arr);`caller owns; `hako_mem_free(data)`, `hako_mem_free(self)`
設計原則
- BoxFirstOpaque Handle 経由のみ)。
- FailFast: NULL/長さ不整合/OOB は安定タグで失敗。
- 既定OFF・CLI優先。ENVは短命TTL
受入れ基準
- `.o + .h` を C からリンクし、`hako_string_to_c_copy``hako_array_to_c_copy` が期待どおり動作すること。
- quickoptinにスモーク追加、回帰なし。
範囲外(本フェーズ)
- from_cC string→Nyash StringBox
- ビューborrowptr+len の寿命管理)。
- 文字コード変換/ロケール依存の扱い。
タイムライン34週間
- Week12: Stringcopyout実装スモークヘッダ生成拡張。
- Week34: Arraycopyout実装スモーク負例テストNULL/len=0/OOB