Files
hakorune/docs
nyash-codex c459135238 feat(mir/phi): improve LoopForm parameter detection - track param names
**Problem**: is_parameter() was too simple, checking only ValueId which changes
through copies/PHIs. This caused parameters like 'data' to be misclassified as
carriers, leading to incorrect PHI construction.

**Solution**: Track original parameter names at function entry.

**Changes**:

1. **Added function_param_names field** (builder.rs):
   - HashSet<String> to track original parameter names
   - Populated in lower_static_method_as_function()
   - Cleared and repopulated for each new function

2. **Improved is_parameter()** (loop_builder.rs):
   - Check name against function_param_names instead of ValueId
   - More reliable than checking func.params (ValueIds change)
   - __pin$*$@* variables correctly classified as carriers
   - Added debug logging with NYASH_LOOPFORM_DEBUG

3. **Enhanced debug output** (loopform_builder.rs):
   - Show carrier/pinned classification during prepare_structure()
   - Show variable_map state after emit_header_phis()

**Test Results**:
-  'args' correctly identified as parameter (was working)
-  'data' now correctly identified as parameter (was broken)
-  __pin variables correctly classified as carriers
-  PHI values allocated and variable_map updated correctly
- ⚠️ ValueId undefined errors persist (separate issue)

**Remaining Issue**:
ValueId(10) undefined error suggests PHI visibility problem or VM verification
issue. Needs further investigation of emit_phi_at_block_start() or VM executor.

**Backward Compatibility**:
- Flag OFF: 100% existing behavior preserved (legacy path unchanged)
- Feature-flagged with NYASH_LOOPFORM_PHI_V2=1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 05:24:07 +09:00
..

📚 Nyash Documentation

🚀 はじめに(導線)

  • 現在のタスクと進行状況: ../CURRENT_TASK.md
  • コア概念の速習: reference/architecture/nyash_core_concepts.md
  • 設計ブループリント(文字列/文字コード): development/design/blueprints/strings-utf8-byte.md

📂 ドキュメント構造(指針)

📖 reference/ - 正式な技術仕様

  • language/ - 言語仕様構文、型システム、Box仕様
  • architecture/ - システムアーキテクチャMIR、VM、実行バックエンド
  • api/ - ビルトインBoxのAPI仕様
  • plugin-system/ - プラグインシステム、BID-FFI仕様
    • 🆕🔥 TypeBox ABI統合 + セルフホスティング - ABIすらBoxとして扱う革命的設計
    • まずはこちら: reference/boxes-system/plugin_lifecycle.mdPluginBoxV2のライフサイクル、singleton、nyash.tomlの要点

📚 guides/ - 利用者向けガイド

  • getting-started.md - はじめに(統一版)
  • tutorials/ - ステップバイステップのチュートリアル
  • examples/ - 実践的なサンプルコード
  • wasm-guide/ - WebAssemblyビルドガイド

🧩 how-to/ - 目的別ハウツー

  • 手順重視の短いガイド(前提→コマンド→検証)

🔧 development/ - 開発者向け

  • current/ - 現在進行中のタスクCURRENT_TASK.md等
  • roadmap/ - 開発計画
    • phases/ - Phase 812の詳細計画
    • phase-12/ - 🆕🔥 TypeBox統合ABI + Nyash ABI C実装セルフホスティング実現
    • native-plan/ - ネイティブビルド計画
  • proposals/ - RFC、新機能提案

🔌 Net PluginHTTP/TCP

  • 使い方と仕様: reference/plugin-system/net-plugin.md

🗄️ archive/ - アーカイブ

  • consultations/ - AI相談記録gemini/chatgpt/codex
  • decisions/ - 過去の設計決定
  • build-logs/ - ビルドログ、ベンチマーク結果
  • old-versions/ - 古いドキュメント

🎯 クイックアクセス

すぐ始める

  • guides/getting-started.md
  • guides/language-guide.md
  • guides/p2p-guide.md

技術リファレンス

  • reference/language/LANGUAGE_REFERENCE_2025.md
  • reference/language/EBNF.md演算子: ! 採用 / do-while 非採用)
  • reference/language/strings.mdUTF8/Byte 二本柱)
  • reference/architecture/TECHNICAL_ARCHITECTURE_2025.md
  • reference/architecture/execution-backends.md
  • reference/runtime/gc.md
  • reference/plugin-system/
  • tools/cli-options.mdCLI早見表

デザイン/ガイド

  • guides/language-core-and-sugar.mdコア最小糖衣
  • guides/loopform.mdループ正規化
  • guides/scopebox.md開発時の可視化
  • guides/dev-local-alias.md開発向け: 行頭 @name = expr → local 宣言糖衣)
  • guides/box-patterns.mdBoxパターン集Ownership/Lease/Cancel/Capability/Affinity/Observable
  • guides/box-design-checklist.mdBox 設計チェックリスト)
  • proposals/concurrency/boxes.md並行モデルのBox設計Routine/Channel/Select/Scope
  • reference/concurrency/semantics.mdブロッキング/close/select/観測の規約)
  • design/(設計ノート入口)
    • development/design/legacy/flow-blocks.md矢印フロー匿名ブロック・設計草案
    • development/proposals/scope-reuse.mdスコープ再利用ブロック・MVP提案
    • reference/language/match-guards.mdガード連鎖Range・CharClass設計
    • guides/core-principles.md最小構文・ゼロランタイム・可視化の原則

開発状況


📋 再編成について / フォルダの見分け方

ドキュメントは2025年8月20日に再編成されました。詳細はREORGANIZATION_REPORT.mdを参照してください。

旧パスから新パスへの主な変更:

  • 説明書/guides/reference/ に分割
  • 予定/development/roadmap/
  • 散在していたファイル → 適切なカテゴリに整理

補足:

  • reference/ は正本(仕様)。
  • guides/ は読み物、how-to/ は手順書。
  • design/ は公開できる設計ノート。
  • private/ は下書き保管庫(将来 reference//design/ に昇格)。

Nyash は「Everything is Box」哲学に基づく言語です。詳細はコア概念とガイドを参照してください。