phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
@ -42,7 +42,7 @@ Rust製インタープリターによる高性能実行と、直感的な構文
|
||||
| `throw` | 例外発生 | `throw error` |
|
||||
| `nowait` | 非同期実行 | `nowait future = task()` |
|
||||
| `await` | 待機・結果取得 | `result = await future` |
|
||||
| `include` | ファイル取り込み | `include "math.nyash"` |
|
||||
| `include` | ファイル取り込み | `include "math.hako"` |
|
||||
| `print` | 出力(デバッグ用) | `print("Hello")` |
|
||||
| `function`/`fn` | 関数定義 | `fn add(a,b) { }` |
|
||||
| `init` | 初期化ブロック | `init { field1, field2 }` |
|
||||
|
||||
@ -108,14 +108,14 @@ Using resolution is centralized under the `[using]` table. Three forms are suppo
|
||||
- `[using.paths]` — additional search roots for path lookups
|
||||
- Example: `paths = ["apps", "lib", "."]`
|
||||
- `[using.<name>]` — named packages (file or directory)
|
||||
- Keys: `path = "lib/math_utils/"`, optional `main = "math_utils.nyash"`
|
||||
- Keys: `path = "lib/math_utils/"`, optional `main = "math_utils.hako"`
|
||||
- Optional `kind = "dylib"` with `bid = "MathBox"` for plug‑ins (dev only)
|
||||
- `[using.aliases]` — alias mapping from short name to a package name
|
||||
- Example: `aliases.json = "json_native"`
|
||||
|
||||
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` への登録が必須。
|
||||
- `include` は廃止。代替は `using "./path/to/file.hako" as Name`。prod では `nyash.toml` への登録が必須。
|
||||
|
||||
Development toggles
|
||||
- Resolution is performed by the Runner when `NYASH_ENABLE_USING=1`(既定ON)。
|
||||
@ -138,7 +138,7 @@ Development toggles
|
||||
|
||||
Syntax
|
||||
- Namespace: `using core.std` or `using core.std as Std`
|
||||
- File path: `using "apps/examples/string_p0.nyash" as Strings`
|
||||
- File path: `using "apps/examples/string_p0.hako" as Strings`
|
||||
- Relative path is allowed; absolute paths are discouraged.
|
||||
|
||||
Style
|
||||
@ -150,7 +150,7 @@ Style
|
||||
Examples
|
||||
```nyash
|
||||
using core.std as Std
|
||||
using "apps/examples/string_p0.nyash" as Strings
|
||||
using "apps/examples/string_p0.hako" as Strings
|
||||
|
||||
static box Main {
|
||||
main(args) {
|
||||
@ -168,7 +168,7 @@ paths = ["apps", "lib", "."]
|
||||
|
||||
[using.json_native]
|
||||
path = "apps/lib/json_native/"
|
||||
main = "parser.nyash"
|
||||
main = "parser.hako"
|
||||
|
||||
[using.aliases]
|
||||
json = "json_native"
|
||||
@ -204,13 +204,13 @@ static box Main {
|
||||
|
||||
Runner Configuration
|
||||
- Enable using pre‑processing: `NYASH_ENABLE_USING=1`
|
||||
- CLI from-the-top registration: `--using "ns as Alias"` or `--using '"apps/foo.nyash" as Foo'` (repeatable)
|
||||
- CLI from-the-top registration: `--using "ns as Alias"` or `--using '"apps/foo.hako" as Foo'` (repeatable)
|
||||
- Using profiles (phase‑in): `NYASH_USING_PROFILE={dev|ci|prod}`
|
||||
- dev: AST マージ 既定ON、legacy前置きは既定で無効(必要時は `NYASH_LEGACY_USING_ALLOW=1` で一時許可)
|
||||
- ci: AST マージ 既定ON、legacy前置きは既定で無効(同上の一時許可)
|
||||
- prod: AST マージ 既定OFF、toml のみ(file using/path はエラー・追記ガイド)
|
||||
- Strict mode (plugin prefix required): `NYASH_PLUGIN_REQUIRE_PREFIX=1` または `nyash.toml` の `[plugins] require_prefix=true`
|
||||
- Aliases from env: `NYASH_ALIASES="Foo=apps/foo/main.nyash,Bar=lib/bar.nyash"`
|
||||
- Aliases from env: `NYASH_ALIASES="Foo=apps/foo/main.hako,Bar=lib/bar.hako"`
|
||||
- Additional search paths: `NYASH_USING_PATH="apps:lib:."`
|
||||
- Selfhost pipeline keeps child stdout quiet and extracts JSON only: `NYASH_JSON_ONLY=1` (set by Runner automatically for child)
|
||||
- Selfhost emits `meta.usings` automatically when present; no additional flags required.
|
||||
@ -273,7 +273,7 @@ Notes
|
||||
|
||||
このセクションは移行期の参考情報です。`include` は設計上の一貫性と学習コスト低減のため廃止しました。今後はすべて `using` に一本化してください(ファイル・パッケージ・DLL すべてを `using` で扱えます)。既存コードの移行は以下の対応例を推奨します。
|
||||
|
||||
- `local M = include "./path/module.nyash"` → `using "./path/module.nyash" as M`
|
||||
- `local M = include "./path/module.hako"` → `using "./path/module.hako" as M`
|
||||
- `include` の探索ルートは `[using.paths]` に統合(`nyash.toml`)
|
||||
|
||||
注: `include` は完全に非推奨です。コードは `using` に書き換えてください(互換シムは提供しません)。
|
||||
@ -283,7 +283,7 @@ Overview
|
||||
|
||||
Syntax
|
||||
```
|
||||
local Math = include "lib/math.nyash"
|
||||
local Math = include "lib/math.hako"
|
||||
local r = Math.add(1, 2)
|
||||
```
|
||||
|
||||
@ -294,7 +294,7 @@ Rules
|
||||
- Path resolution(MVP):
|
||||
- Relative allowed; absolute discouraged
|
||||
- nyash.toml `[include.roots]` で `std=/stdlib` 等のルート定義を許可
|
||||
- 省略拡張は `.nyash`、ディレクトリなら `index.nyash`
|
||||
- 省略拡張は `.hako`、ディレクトリなら `index.hako`
|
||||
|
||||
Backends
|
||||
- Interpreter: 実行時に評価し Box を返す
|
||||
|
||||
Reference in New Issue
Block a user