rip-lang 3.6.1 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/RIP-TYPES.md CHANGED
@@ -1878,6 +1878,104 @@ Each row is a test case. Verify both .js and .d.ts output.
1878
1878
 
1879
1879
  ---
1880
1880
 
1881
+ ## Current Status
1882
+
1883
+ Rip Types Phase I is complete. The `.d.ts` emission covers the full
1884
+ surface area of the type system — variables, functions, classes, components,
1885
+ type aliases, interfaces, enums, generics, and all four reactive operators.
1886
+
1887
+ Phase II (consuming external `.d.ts` files for IDE intelligence) is in
1888
+ progress via the VS Code extension. Phase III (a standalone Language
1889
+ Server Protocol server) is planned.
1890
+
1891
+ ### Architecture
1892
+
1893
+ The type system uses a two-phase approach:
1894
+
1895
+ 1. **Lexer phase** — `rewriteTypes()` strips type annotations from the token
1896
+ stream and stores them as `.data` metadata on surviving tokens. The parser
1897
+ never sees types.
1898
+ 2. **Compiler phase** — `emitTypes(tokens, sexpr)` runs after parsing,
1899
+ producing `.d.ts` from both annotated tokens (variables, functions, types)
1900
+ and the s-expression tree (components). One function, one output.
1901
+
1902
+ ### What's Working
1903
+
1904
+ **Variables and Constants:**
1905
+
1906
+ | Rip Input | .d.ts Output |
1907
+ |-----------|-------------|
1908
+ | `x:: number = 0` | `let x: number;` |
1909
+ | `x:: number =! 100` | `declare const x: number;` |
1910
+ | `x:: number := 0` | `declare const x: Signal<number>;` |
1911
+ | `x:: number ~= y * 2` | `declare const x: Computed<number>;` |
1912
+ | `x:: Function ~> ...` | `declare const x: () => void;` |
1913
+ | `export` variants of all above | `export const/let ...` |
1914
+
1915
+ **Functions:**
1916
+
1917
+ | Rip Input | .d.ts Output |
1918
+ |-----------|-------------|
1919
+ | `def f(a:: T):: R` | `declare function f(a: T): R;` |
1920
+ | `def f<T>(a:: T):: T` | `declare function f<T>(a: T): T;` |
1921
+ | `def f<T extends Base>(...)` | `declare function f<T extends Base>(...);` |
1922
+ | `f = (a:: T) -> ...` | `declare function f(a: T);` |
1923
+ | `export def ...` | `export function ...;` |
1924
+
1925
+ **Types, Interfaces, and Enums:**
1926
+
1927
+ | Rip Input | .d.ts Output |
1928
+ |-----------|-------------|
1929
+ | `Name ::= type { id: number }` | `type Name = { id: number; };` |
1930
+ | `Name ::= number` | `type Name = number;` |
1931
+ | Block union `::= \| "a" \| "b"` | `type Name = "a" \| "b";` |
1932
+ | `interface Name { ... }` | `interface Name { ... }` |
1933
+ | `interface X extends Y` | `interface X extends Y { ... }` |
1934
+ | Function types `read: => string` | `read: () => string` |
1935
+ | `enum Name { A = 1; B = 2 }` | `enum Name { A = 1, B = 2 }` |
1936
+
1937
+ **Classes:**
1938
+
1939
+ | Rip Input | .d.ts Output |
1940
+ |-----------|-------------|
1941
+ | `class X { prop:: T = val }` | `declare class X { prop: T; }` |
1942
+ | `constructor: (@name:: T) ->` | `constructor(name: T);` |
1943
+ | `method: (a:: T) ->` | `method(a: T);` |
1944
+ | `class X extends Y` | `declare class X extends Y { ... }` |
1945
+
1946
+ **Components:**
1947
+
1948
+ | Rip Input | .d.ts Output |
1949
+ |-----------|-------------|
1950
+ | `Name = component { ... }` | `declare class Name { ... }` |
1951
+ | Reactive state `count:: number := 0` | `count: number;` |
1952
+ | Computed `doubled ~= ...` | `readonly doubled: any;` |
1953
+ | Methods | Method declarations |
1954
+ | Auto-generated | `constructor`, `mount()`, `unmount()` |
1955
+
1956
+ **Infrastructure:**
1957
+
1958
+ | Feature | Status |
1959
+ |---------|--------|
1960
+ | `Signal<T>` / `Computed<T>` preamble | Auto-generated when `:=` or `~=` used |
1961
+ | Import pass-through | Working |
1962
+ | Export default | Working |
1963
+ | Optional properties (`email?: string`) | Working |
1964
+ | Type suffixes (`T?`, `T??`, `T!`) | Working |
1965
+ | Generic constraints (`<T extends X>`) | Working |
1966
+ | Deferred emission (after parsing) | Working |
1967
+ | Component variable deduplication | Working |
1968
+
1969
+ ### Roadmap
1970
+
1971
+ | Phase | Description | Status |
1972
+ |-------|-------------|--------|
1973
+ | Phase I | `.d.ts` emission from annotated Rip code | **Complete** |
1974
+ | Phase II | External type consumption — read third-party `.d.ts` files for autocomplete, hover, and go-to-definition | In progress (VS Code extension) |
1975
+ | Phase III | Language Server Protocol — full LSP server for IDE-agnostic type intelligence | Planned |
1976
+
1977
+ ---
1978
+
1881
1979
  **See Also:**
1882
1980
  - [RIP-LANG.md](RIP-LANG.md) — Language reference
1883
1981
  - [RIP-REACTIVITY.md](RIP-REACTIVITY.md) — Reactive system details