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:
@ -7,15 +7,15 @@
|
||||
my-awesome-app/
|
||||
├── nyash.link # 依存関係定義
|
||||
├── src/
|
||||
│ ├── main.nyash # メインファイル
|
||||
│ ├── main.hako # メインファイル
|
||||
│ ├── models/
|
||||
│ │ └── user.nyash # ユーザーモデル
|
||||
│ │ └── user.hako # ユーザーモデル
|
||||
│ └── utils/
|
||||
│ └── helpers.nyash # ヘルパー関数
|
||||
│ └── helpers.hako # ヘルパー関数
|
||||
├── libs/
|
||||
│ └── custom_lib.nyash # カスタムライブラリ
|
||||
│ └── custom_lib.hako # カスタムライブラリ
|
||||
└── stdlib/
|
||||
└── nyashstd.nyash # 標準ライブラリ
|
||||
└── nyashstd.hako # 標準ライブラリ
|
||||
```
|
||||
|
||||
### 📋 nyash.linkファイル例
|
||||
@ -27,14 +27,14 @@ description = "Everything is Box philosophy in action!"
|
||||
|
||||
[dependencies]
|
||||
# 標準ライブラリ
|
||||
nyashstd = { path = "./stdlib/nyashstd.nyash" }
|
||||
nyashstd = { path = "./stdlib/nyashstd.hako" }
|
||||
|
||||
# プロジェクト内モジュール
|
||||
user_model = { path = "./src/models/user.nyash" }
|
||||
helpers = { path = "./src/utils/helpers.nyash" }
|
||||
user_model = { path = "./src/models/user.hako" }
|
||||
helpers = { path = "./src/utils/helpers.hako" }
|
||||
|
||||
# カスタムライブラリ
|
||||
custom_lib = { path = "./libs/custom_lib.nyash" }
|
||||
custom_lib = { path = "./libs/custom_lib.hako" }
|
||||
|
||||
[search_paths]
|
||||
stdlib = "./stdlib/"
|
||||
@ -42,14 +42,14 @@ src = "./src/"
|
||||
libs = "./libs/"
|
||||
|
||||
[build]
|
||||
entry_point = "./src/main.nyash"
|
||||
entry_point = "./src/main.hako"
|
||||
```
|
||||
|
||||
## 🌟 実用的なコード例
|
||||
|
||||
### 1. 基本的なusing使用
|
||||
```nyash
|
||||
# ===== src/main.nyash =====
|
||||
# ===== src/main.hako =====
|
||||
using nyashstd
|
||||
using helpers
|
||||
|
||||
@ -77,7 +77,7 @@ static box Main {
|
||||
|
||||
### 2. 標準ライブラリ定義例
|
||||
```nyash
|
||||
# ===== stdlib/nyashstd.nyash =====
|
||||
# ===== stdlib/nyashstd.hako =====
|
||||
namespace nyashstd {
|
||||
static box string {
|
||||
static upper(str) {
|
||||
@ -139,7 +139,7 @@ namespace nyashstd {
|
||||
|
||||
### 3. ヘルパーモジュール例
|
||||
```nyash
|
||||
# ===== src/utils/helpers.nyash =====
|
||||
# ===== src/utils/helpers.hako =====
|
||||
using nyashstd
|
||||
|
||||
static function process_data(data) {
|
||||
@ -161,7 +161,7 @@ static function format_user_name(first, last) {
|
||||
|
||||
### 4. モデル定義例
|
||||
```nyash
|
||||
# ===== src/models/user.nyash =====
|
||||
# ===== src/models/user.hako =====
|
||||
using nyashstd
|
||||
using helpers
|
||||
|
||||
@ -200,7 +200,7 @@ box User {
|
||||
|
||||
### 1. シンプルなWebサーバー
|
||||
```nyash
|
||||
# ===== web_server.nyash =====
|
||||
# ===== web_server.hako =====
|
||||
using nyashstd
|
||||
using custom_lib
|
||||
|
||||
@ -245,7 +245,7 @@ server.start()
|
||||
|
||||
### 2. データ処理パイプライン
|
||||
```nyash
|
||||
# ===== data_processor.nyash =====
|
||||
# ===== data_processor.hako =====
|
||||
using nyashstd
|
||||
using helpers
|
||||
|
||||
@ -341,8 +341,8 @@ local sin_val = sin(3.14) # math.sin不要
|
||||
### Before(現在のinclude使用)
|
||||
```nyash
|
||||
# ===== 既存のtext_adventure例 =====
|
||||
include "text_adventure/items.nyash"
|
||||
include "text_adventure/rooms.nyash"
|
||||
include "text_adventure/items.hako"
|
||||
include "text_adventure/rooms.hako"
|
||||
|
||||
# アイテム作成
|
||||
local sword = new Weapon("Sword", 10)
|
||||
@ -352,10 +352,10 @@ local sword = new Weapon("Sword", 10)
|
||||
```nyash
|
||||
# ===== nyash.link =====
|
||||
[dependencies]
|
||||
game_items = { path = "./text_adventure/items.nyash" }
|
||||
game_rooms = { path = "./text_adventure/rooms.nyash" }
|
||||
game_items = { path = "./text_adventure/items.hako" }
|
||||
game_rooms = { path = "./text_adventure/rooms.hako" }
|
||||
|
||||
# ===== main.nyash =====
|
||||
# ===== main.hako =====
|
||||
using game_items
|
||||
using game_rooms
|
||||
|
||||
|
||||
Reference in New Issue
Block a user