@skillstech/thunderlang 0.5.9 → 0.5.11

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/CHANGELOG.md CHANGED
@@ -1,3 +1,71 @@
1
+ # 0.5.11
2
+
3
+ **Language: choices among cases, and inner functions, in the flow.**
4
+ - A `switch`, `when`, `match`, or `select` is one question with one side per case ("Chooses by score": "When it is
5
+ from 90 to 100", …, "Otherwise"), not a yes/no question. Flow blocks carry `cases: [{ label, blocks }]`, the
6
+ decision node `cases: true`, and its edges `label: 'case'` with the case's `text` (the edge into an inner function's steps is `label: 'nested'`). Without an Otherwise, "None of
7
+ these" carries straight on.
8
+ - An inner function (a React hook, a callback, `go`/`defer`, a closure) is its own sub-flow (`nested: true` on its
9
+ block): a return or stop inside it ends only that function, and the outer flow carries on from the step. Details no
10
+ longer lists its returns and stops as the outer action's endings.
11
+ - Destructured parameters (React props `{ userId, name }`) are what goes in: "user id, name".
12
+ - SQL is in the reader on thunderlang.dev/read, with a sample; pasted SQL is recognized.
13
+
14
+ # 0.5.10
15
+
16
+ **Language: SQL.** Thunder reads `.sql` files: tables become Data or Things (columns in words, defaults, always
17
+ set, what they point to), `CREATE TYPE … AS ENUM` becomes Choices, `CHECK` and `UNIQUE` become rules the table
18
+ enforces (a No stops the row: "Refused by the database"), and views, functions, procedures (PL/pgSQL), and triggers
19
+ become steps. PostgreSQL first; MySQL, SQLite, and SQL Server where their syntax agrees. Spec section 9 updated.
20
+
21
+ **Read once.** `readFiles(files)` (in `/core`) reads every file once; `thunderModel`, `thunderizeFiles`, and
22
+ `sameMeaning` reuse each file's `reading`, with identical results. On Django (2,376 files) the three stages together
23
+ take 3.8 s reading once, against 11.6 s when each stage reads. The model no longer checks every Thing against every
24
+ member when it tidies empty classes (13.3 s to 3.4 s on Django). `scripts/perf.mjs` reports both totals.
25
+
26
+ **Language: Big Picture in all ten languages.** Classes, structs, records, data classes, and enums become Things,
27
+ Data, and Choices in Java, C#, Kotlin, PHP, Go, Rust, and Ruby, as they already did in Python, TypeScript, and
28
+ JavaScript: what each knows (with its kind in words and how it starts, from constructors, `init`, `__construct`,
29
+ `initialize`, Go `NewX`, and Rust `new`), its choices, its doc comment, and what it can do. Go methods with a
30
+ receiver and Rust `impl` blocks belong to their type although they are written outside it. Interfaces and traits
31
+ are contracts, not Things. Empty error classes are left out (errors show where they stop a path); other empty classes
32
+ are records. Checked on cobra, log, MediatR, gson, timber, guzzle, and sinatra.
33
+
34
+ **Language: Details for web handlers.** What follows a guard that can stop only happens on its other side (an
35
+ action's answer says "when Is org set? Yes", not "Always"), and a returned object names its keys ("Gives back org,
36
+ repos, avg, and failing").
37
+ **Language: functions inside functions, values chosen by if / match / when, do … while, and Go select are read.**
38
+ Fewer steps are left as code ("Not read yet"); see docs/language-audit.md for the numbers on 11 open-source repos
39
+ (formik branches shown 52% → 91%, timber 73% → 91%, cobra 64% → 81%).
40
+ - Functions written inside a function show their own steps under the step that holds them (marked `nested: true`):
41
+ React `useEffect` ("When this first shows on screen, and whenever user id changes", "Every time this is drawn on
42
+ screen", cleanup "When this is taken off the screen, cleans up"), `useMemo` ("Works out full name and remembers
43
+ it until user changes"), `useCallback` and `use…Callback` ("Defines how handle save works"), inner functions and
44
+ Python inner `def`s, Go `go func() {…}()` ("Starts these steps running alongside, without waiting for them") and
45
+ `defer func() {…}()` ("At the end, runs these steps"), Go function values, Java/C# lambdas, Rust closures,
46
+ Kotlin trailing lambdas (`user?.let { … }` reads "If user is set", `repeat(3)` "Repeats 3 times"), Ruby `do`
47
+ blocks, `setTimeout` ("After 300 milliseconds"), event listeners (`Whenever "click" happens`) and promise
48
+ callbacks ("When load is done", "If load goes wrong"). `return new Promise((resolve) => { … })` reads "Makes a
49
+ new Promise with these steps", then "Returns a new Promise". Python `with`, C# `using`/`lock` and Java
50
+ `synchronized` blocks show their steps (Java `synchronized (x) {` is no longer read as a function).
51
+ - `if` used as a value reads like a ternary: Kotlin `val x = if (a) b else c`, Rust `let x = if a { b } else { c }`,
52
+ Ruby `x = if a then b else c end` ("Sets bonus to 5 if score is more than 90, otherwise 0"). Over several lines
53
+ it reads as the question, each side ending in "Sets label to …" (or "Returns …" for `return if` / `return when`).
54
+ - The arms of a Rust `match`, Kotlin `when`, C# `switch` expression and PHP `match` are read one by one, each with
55
+ what it does: "When it is from 0 to 49" → "Sets label to "fail"", "When it is stop or halt", "Otherwise".
56
+ Kotlin `when (x) {` reads "Chooses by x" (was "If x is set").
57
+ - `do { … } while (cond)` reads "Runs once, then repeats while …" with its steps (was "Calls do" plus a separate
58
+ loop with no steps). `for (; i < n; i++)` reads "Repeats while i is less than n".
59
+ - Go `select` reads "Waits for whichever of these is ready first" (with `default`: "Checks which of these is ready,
60
+ without waiting"); its cases read "When msg arrives from ch", "When ctx is cancelled or times out", "When 5
61
+ seconds have passed", "When 1 can be sent to out", "If none is ready yet". `fallthrough` reads "Carries on into
62
+ the next case too". `switch {` reads "Checks these cases in order" and its cases "When age is more than 65".
63
+ - A `case 'a':` / `default:` label is a statement of its own, so the first step of every case is shown (it was
64
+ folded into the label). A bare `{ … }` block inside a case is read in place.
65
+ - Also fixed: a Python comprehension filter (`[i for i in xs if keep(i)]`) is no longer read as "If keep(i)]";
66
+ an `if` condition written over several lines is read whole; `(x as T).then(…)` keeps its parentheses;
67
+ `delete registry[name]` reads "Removes name from registry"; Ruby `else "value"` on one line keeps its value.
68
+
1
69
  # 0.5.9
2
70
 
3
71
  **Language: redirects say where the person goes.** A redirect reads "Sends the person to /login" (or "the Google