feat: Prepare for code modularization and cleanup
- Archive old documentation and test files to `docs/archive/` and `local_tests/`. - Remove various temporary and old files from the project root. - Add `nekocode-rust` analysis tool and its output files (`nekocode/`, `.nekocode_sessions/`, `analysis.json`). - Minor updates to `apps/chip8_nyash/chip8_emulator.nyash` and `local_tests` files. This commit cleans up the repository and sets the stage for further code modularization efforts, particularly in the `src/interpreter` and `src/parser` modules, based on recent analysis.
This commit is contained in:
40
docs/archive/weak_reference_architecture_consultation.txt
Normal file
40
docs/archive/weak_reference_architecture_consultation.txt
Normal file
@ -0,0 +1,40 @@
|
||||
Nyash言語のweak参照実装で根本的な設計問題が発覚しました。専門的分析をお願いします。
|
||||
|
||||
【現在の問題】
|
||||
InstanceBox構造が原因でweak参照が実装できません:
|
||||
|
||||
```rust
|
||||
pub struct InstanceBox {
|
||||
pub fields: Arc<Mutex<HashMap<String, Box<dyn NyashBox>>>>, // 問題の核心
|
||||
}
|
||||
```
|
||||
|
||||
NyashValue::WeakBoxを作っても、Box<dyn NyashBox>にしか格納できず、弱参照情報が失われます。
|
||||
|
||||
【解決策の選択肢】
|
||||
|
||||
1. **根本解決**(理想だが影響大)
|
||||
```rust
|
||||
pub fields: Arc<Mutex<HashMap<String, NyashValue>>>, // 全面アーキテクチャ変更
|
||||
```
|
||||
|
||||
2. **暫定解決**(copilot提案)
|
||||
```rust
|
||||
pub struct InstanceBox {
|
||||
pub fields: Arc<Mutex<HashMap<String, Box<dyn NyashBox>>>>, // 既存維持
|
||||
pub weak_fields: Arc<Mutex<HashMap<String, Weak<Mutex<dyn NyashBox>>>>>, // 追加
|
||||
}
|
||||
```
|
||||
|
||||
【コンテキスト】
|
||||
- NyashValue革命は完了済み(Arc<Mutex>過剰症候群解決)
|
||||
- Everything is Box哲学必須
|
||||
- 実用性重視(完璧より動くもの優先)
|
||||
|
||||
【質問】
|
||||
1. 暫定解決策の技術的妥当性は?
|
||||
2. パフォーマンス・保守性への影響は?
|
||||
3. 根本解決は本当に必要か?
|
||||
4. 段階的移行戦略の是非は?
|
||||
|
||||
実装可能性と設計の美しさのバランスを重視した分析をお願いします。
|
||||
Reference in New Issue
Block a user