Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manuals/1.0/en/12-philosophy-behind.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ function processUser(ValidatedUser $user) {

The idea: rather than handling errors, make certain errors impossible to represent.

Sartre wrote "Existence precedes essence"—we exist first, then define ourselves. In Be Framework: Existence precedes action—what you ARE determines what you CAN DO.

---

## 4. Heraclitus: Everything Flows
Expand Down Expand Up @@ -350,6 +352,7 @@ These philosophical ideas share common themes:
|------------|-------------------------|--------------------------|
| Heraclitus | Flow | `Input → Being → Final` |
| Aristotle | Potentiality | `Success|Failure $being` |
| Sartre | Existence precedes essence | Type determines capability |
| Laozi | Non-forcing | `#[Be]` declaration |
| Buddhism | Interdependence | `#[Input]` + `#[Inject]` |
| Spinoza | Immanence/Transcendence | Input/Inject distinction |
Expand Down
4 changes: 2 additions & 2 deletions manuals/1.0/en/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ src/
├── Reason/
│ └── Greeting.php # Transcendent capability
├── Semantic/
│ └── Name.php # Validation rules
│ └── Name.php # Semantic variables
├── Exception/
│ └── EmptyNameException.php
└── Module/
Expand Down Expand Up @@ -156,4 +156,4 @@ Ready for a more complete example with Being classes and branching? Continue to
Or revisit the concepts:
- [Input Classes](./02-input-classes.html) - Starting points
- [Final Objects](./04-final-objects.html) - Destinations
- [Semantic Variables](./06-semantic-variables.html) - Validation
- [Semantic Variables](./06-semantic-variables.html) - Domain ontology
53 changes: 26 additions & 27 deletions manuals/1.0/en/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final class HeartRate
}
```

**Key insight:** These aren't just validation rules. They define your **domain ontology**—the vocabulary of what can exist. This declarative foundation serves as documentation that both humans and AI can read to understand your domain. (See [Semantic Variables](./06-semantic-variables.html) for how this enables AI-readable system design.)
These aren't just validation rules. They define your domain ontology—the vocabulary of what can exist. This declarative foundation serves as documentation that both humans and AI can read to understand your domain. (See [Semantic Variables](./06-semantic-variables.html) for details.)

## Step 2: Define Exceptions

Expand All @@ -96,7 +96,7 @@ final class LethalVitalException extends DomainException

## Step 3: Define the Reason (Transcendence)

The **JTASProtocol** (Japan Triage and Acuity Scale) is not a programmer's arbitrary rule. It represents **transcendent medical wisdom**—objective knowledge that exists independently in the world. In Be Framework, such domain logic becomes a **first-class citizen**: injectable, testable, and explicitly visible.
The JTASProtocol (Japan Triage and Acuity Scale) is not a programmer's arbitrary rule. It represents transcendent medical wisdom—objective knowledge that exists independently in the world. In Be Framework, such domain logic becomes a **first-class citizen**: injectable, testable, and explicitly visible.

```php
// src/Reason/JTASProtocol.php
Expand Down Expand Up @@ -186,14 +186,11 @@ final readonly class TriageAssessment
}
```

**Key concepts:**
- `#[Inject]` brings in the JTASProtocol—transcendent wisdom from outside
- The `$being` property (Union type) determines which Final class receives the transformation
- We don't "set status"—the patient BECOMES their destiny
`#[Inject]` brings in the JTASProtocol—transcendent wisdom from outside. The `$being` property (Union type) determines which Final class receives the transformation. We don't "set status"—the patient BECOMES their destiny.

## Step 7: Create Final Classes

The final forms—each with their own **unique capabilities**:
The final forms—each with unique capabilities:

### EmergencyCase

Expand Down Expand Up @@ -262,7 +259,7 @@ final readonly class ObservationCase
}
```

Notice: Each outcome has **different methods**. `EmergencyCase` can `assignER()`, while `ObservationCase` can `assignWaitingArea()`. The **type determines capability**—you cannot assign an ER room to an observation patient.
Each type has different methods. `EmergencyCase` can `assignER()`, while `ObservationCase` can `assignWaitingArea()`. Type determines capability—you cannot assign an ER room to an observation patient.

## Step 8: Execute the Metamorphosis

Expand All @@ -279,14 +276,16 @@ $becoming = new Becoming($injector, 'Be\\App\\Semantic');

// High fever patient
$patient = new PatientArrival(bodyTemperature: 39.5, heartRate: 90);
$result = $becoming($patient);
$final = $becoming($patient);

echo $result->priority; // "IMMEDIATE"
echo $result->color; // "RED"
echo $result->assignER(); // "Secure ER Room 1 immediately..."
echo $final->priority; // "IMMEDIATE"
echo $final->color; // "RED"
echo $final->assignER(); // "Secure ER Room 1 immediately..."
```

## The Complete Flow
## Temporal Existence

All existence flows through time—from Input through Being to Final.

```
PatientArrival(39.5°C, 90 bpm)
Expand Down Expand Up @@ -338,18 +337,20 @@ Problems:

```php
$patient = new PatientArrival($temp, $hr);
$result = $becoming($patient);
$final = $becoming($patient);

// $result IS an EmergencyCase or ObservationCase
// $final IS an EmergencyCase or ObservationCase
// Only EmergencyCase has assignER() method
$result->assignER(); // Type-safe: only possible for EmergencyCase
$final->assignER(); // Type-safe: only possible for EmergencyCase
```

Benefits:
- Non-survivable states cannot exist
- Type IS the status (immutable)
- Capabilities belong to existence

Type determines capability. Existence precedes action.

## Project Structure

```
Expand All @@ -359,7 +360,7 @@ src/
├── Exception/
│ └── LethalVitalException.php
├── Input/
│ └── PatientArrival.php # Raw data
│ └── PatientArrival.php # Entry point
├── Module/
│ └── AppModule.php # DI configuration
├── Final/
Expand All @@ -376,23 +377,21 @@ src/

## Key Insights

1. **Existence over Action**: The patient doesn't "get triaged"—they BECOME a triaged state
2. **Type IS Status**: `EmergencyCase` and `ObservationCase` are different types with different capabilities
3. **Semantic Boundaries**: Lethal vital signs are rejected before metamorphosis
4. **Transcendent Wisdom**: JTASProtocol exists independently—it's injected, not created
5. **Immutability**: Once transformed, a patient cannot change status without new metamorphosis
The patient doesn't "get triaged"—they become a triaged state. `EmergencyCase` and `ObservationCase` are different types with different capabilities. Once transformed, status cannot change without new metamorphosis.

All existence is relational, temporal, ever-becoming. Immanence meets transcendence. New being emerges. "To be is to become."

## Metamorphosis in Other Domains

The same pattern applies everywhere:

| Domain | Input | Being | Final | Reason |
|--------|-------|-------|---------|--------|
| **Triage** | PatientArrival | TriageAssessment | Emergency/Observation | JTASProtocol |
| **Brewing** | RawMaterials | Fermentation | PremiumSake/Vinegar | YeastCulture |
| **Immigration** | VisaApplication | ConsularReview | Resident/Visitor | ImmigrationLaw |
| **Justice** | Evidence | Trial | Guilty/Acquitted | PenalCode |
| **Stellar** | GasCloud | Protostar | Star/BlackHole | PhysicsLaws |
| Triage | PatientArrival | TriageAssessment | Emergency/Observation | JTASProtocol |
| Brewing | RawMaterials | Fermentation | PremiumSake/Vinegar | YeastCulture |
| Immigration | VisaApplication | ConsularReview | Resident/Visitor | ImmigrationLaw |
| Justice | Evidence | Trial | Guilty/Acquitted | PenalCode |
| Stellar | GasCloud | Protostar | Star/BlackHole | PhysicsLaws |

Every domain has its metamorphosis. Every existence has its reason.

Expand Down
3 changes: 3 additions & 0 deletions manuals/1.0/ja/12-philosophy-behind.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ function processUser(ValidatedUser $user) {

アイデア:エラーを処理するのではなく、特定のエラーを表現不可能にする。

サルトルは「実存は本質に先立つ」と書きました—私たちはまず存在し、それから自分自身を定義します。Be Frameworkでは:存在は行動に先立つ—何であるかが何をできるかを決定します。

---

## 4. ヘラクレイトス:万物は流転する
Expand Down Expand Up @@ -350,6 +352,7 @@ final readonly class PatientSymptoms
|------|------|-------------|
| ヘラクレイトス | 流転 | `Input → Being → Final` |
| アリストテレス | 可能態 | `Success|Failure $being` |
| サルトル | 実存は本質に先立つ | 型が能力を決定する |
| 老子 | 無為 | `#[Be]`宣言 |
| 仏教 | 縁起 | `#[Input]` + `#[Inject]` |
| スピノザ | 内在/超越 | Input/Injectの区別 |
Expand Down
18 changes: 9 additions & 9 deletions manuals/1.0/ja/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ src/
├── Reason/
│ └── Greeting.php # 超越的な能力
├── Semantic/
│ └── Name.php # 検証ルール
│ └── Name.php # 意味的変数
Comment thread
coderabbitai[bot] marked this conversation as resolved.
├── Exception/
│ └── EmptyNameException.php
└── Module/
Expand All @@ -69,7 +69,7 @@ final readonly class HelloInput
}
```

`#[Be]` 属性は**運命**を宣言します—この入力が何になるかを。
`#[Be]` 属性はこの入力が何になるか、自らの**運命**を宣言します。

### Final クラス

Expand All @@ -87,8 +87,8 @@ final readonly class Hello
}
```

- `#[Input]` は前の段階(HelloInput)からデータを受け取る
- `#[Inject]` は**超越**(外部からの能力)を受け取る
- `#[Input]` は前の段階(HelloInput)からデータを受け取ります。
- `#[Inject]` は外部からの能力(トランセンデンス)を受け取ります。

### Reason クラス

Expand All @@ -99,9 +99,9 @@ final class Greeting
}
```

Greeting は**超越的な能力**—挨拶する力—を提供します。
Greeting はトランセンデンス — 挨拶する力—を提供します。

### 変態の実行
### 変態(メタモルフォーシス)の実行

```php
$injector = new Injector(new AppModule());
Expand All @@ -122,7 +122,7 @@ Hello (Greeting が注入された状態)
→ "Hello World"
```

入力は何も「しなかった」—変態を通じて Hello に**なった**のです。
入力オブジェクトは何もしていません — 変態を通じて Hello になった(BEING)のです。

## セマンティック検証を試す

Expand All @@ -138,7 +138,7 @@ $input = new HelloInput('');
php bin/app.php
```

`Semantic/Name.php` が名前が空であることを検証するため、エラーメッセージが表示されます。
`Semantic/Name.php` が名前が空であることを検証するため、エラーメッセージが表示されます。空の名前では存在ができないのです。

## 示された主要概念

Expand All @@ -156,4 +156,4 @@ Being クラスと分岐を含むより完全な例に進む準備ができま
または概念を復習:
- [Input Classes](./02-input-classes.html) - 出発点
- [Final Objects](./04-final-objects.html) - 目的地
- [Semantic Variables](./06-semantic-variables.html) - 検証
- [Semantic Variables](./06-semantic-variables.html) - ドメインオントロジー
Loading