hv1 verify: add direct route (env JSON) and clean inline path; fix v1 phi incoming order; make test_runner use hv1 direct; add phase2037 phi canaries; load modules.workspace exports for alias; update docs (phase-20.38, source extensions) and CURRENT_TASK

This commit is contained in:
nyash-codex
2025-11-04 16:33:04 +09:00
parent 5a1bb549a7
commit 30aa39f50b
270 changed files with 4320 additions and 758 deletions

View File

@ -2,15 +2,15 @@
**実装状況**: Phase 15.5後に本格実装予定 | 基本ドット記法は実装済み
Status: Accepted (Runnerside resolution). Selfhost parser accepts using as noop and attaches `meta.usings` for future use.
Status: Accepted (Runnerside resolution). Using is resolved by the Runner; prelude is merged as text (DFS) before parsing/execution.
> Phase 15.5 指針(いいとこ取り)
> - 依存の唯一の真実SSOT: `nyash.toml` の `[using]`aliases/packages/paths
> - 実体の合成: テキスト結合は廃止し、AST マージに一本化(曖昧さ根絶
> - プロファイル運用: `NYASH_USING_PROFILE={dev|ci|prod}` で厳格度を段階的に切替
> - dev: toml + ファイル内 using を許可(実験/便利)
> - ci: toml 優先、ファイル using は警告または限定許可
> - prod: toml のみ。ファイル using/path はエラー(追記ガイドを提示)
Phase 20.36 更新
- 依存の唯一の真実SSOT: `nyash.toml``[using]`aliases/packages/paths
- 実体の合成は“テキスト統合merge_prelude_text”に一本化AST マージは撤退
- プロファイル運用: `NYASH_USING_PROFILE={dev|ci|prod}` で厳格度を段階的に切替
- dev: toml + ファイル内 using を許可(実験/bringup
- ci: toml 優先、ファイル using は警告または限定許可
- prod: toml のみ。ファイル using/path はエラー(追記ガイドを提示)
## 🎯 設計思想Everything has Namespace
@ -61,15 +61,22 @@ pub enum QualifiedCallee {
- **スコープ演算子**: `::global_func``Type::static_method`
- **厳密解決**: コンパイル時名前空間検証
Policy
PolicyRunner前処理
- Accept `using` lines at the top of the file to declare module namespaces or file imports.
- Resolution is performed by the Rust Runner when `NYASH_ENABLE_USING=1`.
- 実体の結合は AST マージのみ。テキストの前置き/連結は行わない(レガシー経路は呼び出し側から削除済み)
- 実体の結合はテキスト統合merge_prelude_text。AST マージ経路は撤退
- Runner は `nyash.toml``[using]` を唯一の真実として参照prod。dev/ci は段階的に緩和可能。
- Selfhost compiler (Ny→JSON v0) collects using lines and emits `meta.usings` when present. The bridge currently ignores this meta field.
- Prelude の中にさらに `using` が含まれている場合は、Runner が再帰的に `using` をストリップしてから AST として取り込みます(入れ子の前処理をサポート)。
- パス解決の順序dev/ci: 呼び出し元ファイルのディレクトリ → `$NYASH_ROOT` → 実行バイナリからのプロジェクトルート推定target/release/nyash の 3 階層上)→ `nyash.toml``[using.paths]`
Deprecated: `include`
- 言語仕様としてはサポートしないVM/コンパイラともに受理しない)。
- 例外は開発支援用の前処理preincludeのみ。実行系や言語仕様の責務ではなく、テストハーネスからフラグで明示的に有効化する。
- Flags: `NYASH_PREINCLUDE=1` / `HAKO_PREINCLUDE=1`既定OFF
- quick プロファイルでは include 依存は既定で SKIP`SMOKES_INCLUDE_POLICY=skip|warn|error`。順次 ERROR へ移行予定)。
- 本番prodでは using/alias のみを正道に固定。`using "path"` は開発限定(`NYASH_ALLOW_USING_FILE=1`)で運用する。
## Namespace Resolution (Runnerside)
- Goal: keep IR/VM/JIT untouched. All resolution happens in Runner/Registry.
- Default search order (3 stages, deterministic):
@ -110,6 +117,12 @@ Notes
- Aliases are fully resolved: `using json` first rewrites to `json_native`, then resolves to a concrete path via `[using.json_native]`.
- `include` は廃止。代替は `using "./path/to/file.nyash" as Name`。prod では `nyash.toml` への登録が必須。
Development toggles
- Resolution is performed by the Runner when `NYASH_ENABLE_USING=1`既定ON
- Prelude は常にテキスト統合DFS/循環検出/キャッシュ)。`NYASH_USING_AST` は後方互換のために残るが AST マージは行わない。
- `NYASH_RESOLVE_TRACE=1` で解決ログcachehit/候補/未解決)を出力。
- 前処理は最小 normalize を適用CRLF→LF、`}` 直前の冗長 `;` を除去、EOF 改行付加。prod のコードスタイルに依存しないこと。
### Dylib autoload (dev guard)
- Enable autoload during using resolution: set env `NYASH_USING_DYLIB_AUTOLOAD=1`.
- Resolution returns a token `dylib:<path>`; when autoload is on, Runner calls the plugin host to `load_library_direct(lib_name, path, boxes)`.