- 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.
51 lines
1.9 KiB
Plaintext
51 lines
1.9 KiB
Plaintext
Nyashプログラミング言語のコンストラクタ設計について深い相談です。
|
||
|
||
【Nyashの現在の設計哲学】
|
||
Nyashは既に「コンストラクタの明示的呼び出し」を採用しています。これは以下の理由によるものです:
|
||
- 明示性重視:プログラマーが何が起きているかを隠さない
|
||
- 初学者フレンドリー:実行順序が直感的
|
||
- Everything is Box哲学:隠れた魔法的な動作を避ける
|
||
|
||
【他言語の問題例】
|
||
```cpp
|
||
// C++:複雑で読みにくい
|
||
class Cat : public Animal {
|
||
Toy catToy; // 1. 隠れたメンバー初期化
|
||
Cat(string name) : Animal(name) { // 2. : Animal(name) が直感的でない
|
||
// 3. 最後に自分の処理
|
||
}
|
||
};
|
||
```
|
||
|
||
【現在のNyash vs 新提案】
|
||
```nyash
|
||
// 現在の書き方
|
||
box MeshNode : P2PBox {
|
||
constructor(nodeId, world) {
|
||
super P2PBox(nodeId, world) // 特別なキーワード
|
||
me.routing = RoutingTable()
|
||
}
|
||
}
|
||
|
||
// 新提案:完全統一
|
||
box MeshNode : P2PBox {
|
||
constructor(nodeId, world) {
|
||
from P2PBox.constructor(nodeId, world) // from統一!
|
||
me.routing = RoutingTable()
|
||
}
|
||
}
|
||
```
|
||
|
||
【完全統一のメリット】
|
||
- from P2PBox.method() と完全に一貫している
|
||
- 「どの親の何を呼んでいるか」が超明確
|
||
- 多重デリゲーションでも from Logger.constructor() で区別可能
|
||
|
||
【深く考えてほしい点】
|
||
1. Nyashの明示的コンストラクタ呼び出し設計をどう評価しますか?
|
||
2. from P2PBox.constructor() の完全統一案をどう思いますか?
|
||
3. 他言語(Java, Python, C#等)と比較したNyashの優位性は?
|
||
4. 初学者にとって最も理解しやすい設計は?
|
||
5. 言語の美しさ・一貫性の観点からの評価は?
|
||
|
||
プログラミング言語設計の専門的視点から、深く分析してください。 |