docs: update type terminology from Int/Float/String/Bool to Number/Decimal/Text/Boolean
This commit is contained in:
@@ -5,6 +5,10 @@ All notable changes to the Storybook Intermediate Representation format.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
> **Note:** As of v0.3.0, value type names have been renamed: Int→Number,
|
||||
> Float→Decimal, String→Text, Bool→Boolean. Historical entries below use the
|
||||
> original terminology from their respective versions.
|
||||
|
||||
---
|
||||
|
||||
## [0.2.0] - 2026-02-13
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
# Storybook Intermediate Representation (SBIR) v0.2.0 Specification
|
||||
|
||||
**Version:** 0.2.0
|
||||
**Status:** Draft
|
||||
**Status:** Archived (superseded by v0.3.0)
|
||||
**Date:** February 2026
|
||||
|
||||
> **Note:** This is a historical specification for SBIR v0.2.0. The current specification
|
||||
> is [SBIR v0.3.0](./SBIR-v0.3.0-SPEC.md). Type names in this document (Int, Float,
|
||||
> String, Bool) reflect v0.2.0 terminology; v0.3.0 renamed these to Number, Decimal,
|
||||
> Text, and Boolean respectively.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
# Storybook DSL — Design Plan
|
||||
|
||||
**Status:** Proposal
|
||||
**Status:** Historical (early design proposal)
|
||||
**Author:** Sienna + Lonni
|
||||
**Date:** February 2026
|
||||
**Scope:** Content authoring language, parser, resolver, tooling for Aspen agent simulation
|
||||
|
||||
> **Note:** This is an early design document that predates the current implementation.
|
||||
> Type names referenced here (Integer, Float, Boolean, String) use the original
|
||||
> terminology; v0.3.0 renamed these to Number, Decimal, Boolean, and Text respectively.
|
||||
> See the current reference documentation for up-to-date syntax and semantics.
|
||||
|
||||
---
|
||||
|
||||
## 1. What This Document Covers
|
||||
|
||||
@@ -79,8 +79,8 @@ template Villager {
|
||||
```
|
||||
|
||||
**Range syntax:**
|
||||
- Integer ranges: `min..max` (inclusive)
|
||||
- Float ranges: `min..max` (inclusive)
|
||||
- Number ranges: `min..max` (inclusive)
|
||||
- Decimal ranges: `min..max` (inclusive)
|
||||
- Both bounds must be same type
|
||||
- min ≤ max required
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Expressions are logical statements that evaluate to `true` or `false`. They comb
|
||||
| <quantifier>
|
||||
| "(" <expression> ")"
|
||||
|
||||
<literal> ::= <int> | <float> | <string> | <bool>
|
||||
<literal> ::= <number> | <decimal> | <text> | <boolean>
|
||||
|
||||
<identifier> ::= <simple-name>
|
||||
| <qualified-path>
|
||||
@@ -117,7 +117,7 @@ status == active
|
||||
|
||||
**Type compatibility:**
|
||||
- Both operands must be the same type
|
||||
- Works with: int, float, string, bool, enum values
|
||||
- Works with: number, decimal, text, boolean, enum values
|
||||
|
||||
### Inequality: `!=`
|
||||
|
||||
@@ -139,7 +139,7 @@ age < 18
|
||||
distance < 10.0
|
||||
```
|
||||
|
||||
**Valid types:** int, float
|
||||
**Valid types:** number, decimal
|
||||
|
||||
### Less Than or Equal: `<=`
|
||||
|
||||
@@ -459,15 +459,15 @@ Comparisons require compatible types:
|
||||
|
||||
| Operator | Left Type | Right Type | Valid? |
|
||||
|----------|-----------|------------|--------|
|
||||
| `==`, `!=` | int | int | ✓ |
|
||||
| `==`, `!=` | float | float | ✓ |
|
||||
| `==`, `!=` | string | string | ✓ |
|
||||
| `==`, `!=` | bool | bool | ✓ |
|
||||
| `==`, `!=` | number | number | ✓ |
|
||||
| `==`, `!=` | decimal | decimal | ✓ |
|
||||
| `==`, `!=` | text | text | ✓ |
|
||||
| `==`, `!=` | boolean | boolean | ✓ |
|
||||
| `==`, `!=` | enum | same enum | ✓ |
|
||||
| `==`, `!=` | int | float | ✗ |
|
||||
| `<`, `<=`, `>`, `>=` | int | int | ✓ |
|
||||
| `<`, `<=`, `>`, `>=` | float | float | ✓ |
|
||||
| `<`, `<=`, `>`, `>=` | string | string | ✗ |
|
||||
| `==`, `!=` | number | decimal | ✗ |
|
||||
| `<`, `<=`, `>`, `>=` | number | number | ✓ |
|
||||
| `<`, `<=`, `>`, `>=` | decimal | decimal | ✓ |
|
||||
| `<`, `<=`, `>`, `>=` | text | text | ✗ |
|
||||
|
||||
### Implicit Coercion
|
||||
|
||||
@@ -475,8 +475,8 @@ Comparisons require compatible types:
|
||||
|
||||
**Error:**
|
||||
```storybook
|
||||
count == "5" // Error: int vs string
|
||||
health < true // Error: int vs bool
|
||||
count == "5" // Error: number vs text
|
||||
health < true // Error: number vs boolean
|
||||
```
|
||||
|
||||
**Correct:**
|
||||
|
||||
@@ -8,10 +8,10 @@ Storybook supports 12 value types:
|
||||
|
||||
| Type | Example | Use Case |
|
||||
|------|---------|----------|
|
||||
| **Int** | `42`, `-7` | Quantities, IDs, counts |
|
||||
| **Float** | `3.14`, `-0.5` | Measurements, probabilities |
|
||||
| **String** | `"Hello"`, `"Martha"` | Text, names, descriptions |
|
||||
| **Bool** | `true`, `false` | Flags, switches |
|
||||
| **Number** | `42`, `-7` | Quantities, IDs, counts |
|
||||
| **Decimal** | `3.14`, `-0.5` | Measurements, probabilities |
|
||||
| **Text** | `"Hello"`, `"Martha"` | Text, names, descriptions |
|
||||
| **Boolean** | `true`, `false` | Flags, switches |
|
||||
| **Time** | `14:30`, `09:15:30` | Clock times, schedule blocks |
|
||||
| **Duration** | `2h30m`, `45s` | Time intervals |
|
||||
| **Range** | `20..40`, `0.5..1.0` | Template variation bounds |
|
||||
@@ -638,8 +638,8 @@ Storybook has **no implicit type coercion**. All type conversions must be explic
|
||||
**Not allowed:**
|
||||
```storybook
|
||||
character Wrong {
|
||||
count: "42" // Error: expected int, got string
|
||||
flag: 1 // Error: expected bool, got int
|
||||
count: "42" // Error: expected number, got text
|
||||
flag: 1 // Error: expected boolean, got number
|
||||
}
|
||||
```
|
||||
|
||||
@@ -680,10 +680,10 @@ Storybook **does not have `null`**. For optional values, use:
|
||||
|
||||
| Type | Mutable? | Comparable? | Valid in Templates? | Notes |
|
||||
|------|----------|-------------|---------------------|-------|
|
||||
| Int | No | Yes | Yes | 64-bit signed |
|
||||
| Float | No | Yes | Yes | 64-bit IEEE 754 |
|
||||
| String | No | Yes | Yes | UTF-8 |
|
||||
| Bool | No | Yes | Yes | true/false |
|
||||
| Number | No | Yes | Yes | 64-bit signed |
|
||||
| Decimal | No | Yes | Yes | 64-bit IEEE 754 |
|
||||
| Text | No | Yes | Yes | UTF-8 |
|
||||
| Boolean | No | Yes | Yes | true/false |
|
||||
| Time | No | Yes | No | HH:MM or HH:MM:SS |
|
||||
| Duration | No | Yes | No | Compounds (2h30m) |
|
||||
| Range | No | No | Yes (only) | Template variation |
|
||||
|
||||
@@ -71,9 +71,9 @@ life_arc Career { ... } // How someone changes over time
|
||||
Fields use a simple `name: value` format:
|
||||
|
||||
```storybook
|
||||
age: 34 // Integer
|
||||
skill_level: 0.95 // Float
|
||||
name: "Martha Baker" // String
|
||||
age: 34 // Number
|
||||
skill_level: 0.95 // Decimal
|
||||
name: "Martha Baker" // Text
|
||||
is_open: true // Boolean
|
||||
wake_time: 04:30 // Time
|
||||
bake_duration: 45m // Duration
|
||||
|
||||
@@ -18,8 +18,8 @@ Fields use the `name: value` format. Storybook supports several value types:
|
||||
|
||||
| Type | Example | Description |
|
||||
|------|---------|-------------|
|
||||
| Integer | `42` | Whole numbers |
|
||||
| Float | `0.85` | Decimal numbers |
|
||||
| Number | `42` | Whole numbers |
|
||||
| Decimal | `0.85` | Decimal numbers |
|
||||
| String | `"hello"` | Text in double quotes |
|
||||
| Boolean | `true` / `false` | Yes or no values |
|
||||
| Time | `14:30` | Clock times |
|
||||
|
||||
Reference in New Issue
Block a user