## 🚀 主要機能追加 ### EguiBox - GUI開発基盤 - Windows版GUIメモ帳アプリ (simple_notepad.rs, nyash_notepad_jp.rs) - 日本語フォント対応 (NotoSansJP-VariableFont_wght.ttf) - BMPアイコン表示システム (c_drive_icon.bmp) - Windowsエクスプローラー風アプリ (nyash_explorer.rs) - アイコン抽出システム (test_icon_extraction.rs) ### ビジュアルプログラミング準備 - NyashFlow プロジェクト設計完成 (NYASHFLOW_PROJECT_HANDOVER.md) - ビジュアルノードプロトタイプ基盤 - WebAssembly対応準備 ## 🔧 重大バグ修正 ### パーサー無限ループ問題 (3引数メソッド呼び出し) - 原因: メソッドパラメータ解析ループの予約語処理不備 - 修正: src/parser/mod.rs - 非IDENTIFIERトークンのエラーハンドリング追加 - 効果: "from"等の予約語で適切なエラー報告、ハング→瞬時エラー ### MapBoxハング問題調査 - MapBox+3引数メソッド呼び出し組み合わせ問題特定 - バグレポート作成 (MAPBOX_HANG_BUG_REPORT.md) - 事前評価vs必要時評価の設計問題明確化 ## 🧹 コード品質向上 - box_methods.rs を8モジュールに機能分離 - 一時デバッグコード全削除 (eprintln\!, unsafe等) - 構文チェック通過確認済み ## 📝 ドキュメント整備 - CLAUDE.md にGUI開発セクション追加 - Gemini/ChatGPT先生相談ログ保存 (sessions/) - 段階的デバッグ手法確立 ## 🎯 次の目標 - must_advance\!マクロ実装 (無限ループ早期検出) - コマンド引数でデバッグ制御 (--debug-fuel) - MapBox問題の根本修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
84 lines
1.9 KiB
Plaintext
84 lines
1.9 KiB
Plaintext
// P2PBox/IntentBoxをNyashスタイルで実装
|
||
|
||
// IntentBox - シンプルなメッセージバス
|
||
box IntentBox {
|
||
init { listeners }
|
||
|
||
constructor() {
|
||
me.listeners = new MapBox()
|
||
}
|
||
|
||
// メッセージを登録されたリスナーに配信
|
||
deliver(messageType, data, from) {
|
||
local handlers
|
||
handlers = me.listeners.get(messageType)
|
||
|
||
if (handlers != null) {
|
||
local i
|
||
i = 0
|
||
loop (i < handlers.length()) {
|
||
local handler
|
||
handler = handlers.get(i)
|
||
handler.invoke(data, from) // MethodBoxのinvoke
|
||
i = i + 1
|
||
}
|
||
}
|
||
}
|
||
|
||
// リスナー登録
|
||
register(messageType, handler) {
|
||
local handlers
|
||
handlers = me.listeners.get(messageType)
|
||
|
||
if (handlers == null) {
|
||
handlers = new ArrayBox()
|
||
me.listeners.set(messageType, handlers)
|
||
}
|
||
|
||
handlers.add(handler)
|
||
}
|
||
}
|
||
|
||
// P2PBox - IntentBoxを使ってメッセージを送るノード
|
||
box P2PBox {
|
||
init { nodeId, intentBox }
|
||
|
||
constructor(nodeId, intentBox) {
|
||
me.nodeId = nodeId
|
||
me.intentBox = intentBox
|
||
}
|
||
|
||
// メッセージ送信(IntentBoxに任せる)
|
||
send(messageType, data) {
|
||
me.intentBox.deliver(messageType, data, me.nodeId)
|
||
}
|
||
|
||
// メッセージ受信登録
|
||
on(messageType, handler) {
|
||
me.intentBox.register(messageType, handler)
|
||
}
|
||
}
|
||
|
||
// テスト
|
||
print("=== P2PBox Test ===")
|
||
|
||
// 1. IntentBox作成
|
||
local bus
|
||
bus = new IntentBox()
|
||
|
||
// 2. P2PBox作成
|
||
local alice
|
||
alice = new P2PBox("Alice", bus)
|
||
|
||
local bob
|
||
bob = new P2PBox("Bob", bus)
|
||
|
||
// 3. Bobがメッセージ受信設定
|
||
bob.on("greeting", new MethodBox(|data, from| {
|
||
print("Bob received from " + from + ": " + data)
|
||
}))
|
||
|
||
// 4. Aliceがメッセージ送信
|
||
alice.send("greeting", "Hello Bob!")
|
||
|
||
print("Done!") |