Skip to content

Commit 7c4a69b

Browse files
authored
docs: edit some docs to adjust tone (#1237)
* docs: edit some docs to adjust tone * Remove external-stdlib documentation * docs: remove double dashes and clean up AI language * remove polyfill page * docs: replace deprecated float operators with unified operators for v12+ * fix: broken link to deleted external-stdlib page and addFloat type inference * docs: restore removed version markers in build config (#1249) * Apply suggestion from @jderochervlk * Apply suggestion from @jderochervlk * remove dead link
1 parent bc7eb27 commit 7c4a69b

33 files changed

Lines changed: 243 additions & 361 deletions

markdown-pages/blog/release-9-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Our compiler comes with a set of stdlib modules (such as `Belt`, `Pervasives`, e
3434

3535
In previous versions, users couldn't ship their compiled JS code without defining a `package.json` dependency on `bs-platform`. Whenever a ReScript developer wanted to publish a package just for pure JS consumption / lean container deployment, they were required to use a bundler to bundle up their library / stdlib code, which made things way more complex and harder to understand.
3636

37-
To fix this problem, we introduced an `external-stdlib` configuration that allows specifying a pre-compiled stdlib npm package (`@rescript/std`). More details on how to use that feature can be found in our [External Stdlib](../docs/manual/build-external-stdlib.mdx) documentation.
37+
To fix this problem, we introduced an `external-stdlib` configuration that allows specifying a pre-compiled stdlib npm package (`@rescript/std`).
3838

3939
### Less Bundle Bloat when Adding ReScript
4040

markdown-pages/docs/manual/array-and-list.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ order: 12
1010

1111
## Array
1212

13-
Arrays are our main ordered data structure. They work the same way as JavaScript arrays: they can be randomly accessed, dynamically resized, updated, etc.
13+
Arrays are the main ordered data structure in ReScript. They can be randomly accessed, dynamically resized, and updated.
1414

1515
<CodeTab labels={["ReScript", "JS Output"]}>
1616

@@ -84,7 +84,7 @@ myArray[0] = "bye";
8484

8585
**Since 11.1**
8686

87-
You can spread arrays of the the same type into new arrays, just like in JavaScript:
87+
You can spread arrays of the same type into new arrays:
8888

8989
<CodeTab labels={["ReScript", "JS Output"]}>
9090

@@ -96,21 +96,17 @@ let x3 = [...y]
9696
```
9797

9898
```javascript
99-
var Belt_Array = require("rescript/lib/js/belt_Array.js");
100-
10199
var y = [1, 2];
102100

103-
var x = Belt_Array.concatMany([[4, 5], y]);
101+
var x = [4, 5, ...y];
104102

105-
var x2 = Belt_Array.concatMany([[4, 5], y, [7], y]);
103+
var x2 = [4, 5, ...y, 7, ...y];
106104

107-
var x3 = Belt_Array.concatMany([y]);
105+
var x3 = [...y];
108106
```
109107

110108
</CodeTab>
111109

112-
> Note that array spreads compiles to `Belt.Array.concatMany` right now. This is likely to change to native array spreads in the future.
113-
114110
## List
115111

116112
ReScript provides a singly linked list too. Lists are:

markdown-pages/docs/manual/async-await.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ You will probably notice that this looks very similar to `async` / `await` in JS
6767
- `await` may only be called on a `promise` value
6868
- `await` calls are expressions, therefore they can be used in pattern matching (`switch`)
6969
- A function returning a `promise<'a>` is equivalent to an `async` function returning a value `'a` (important for writing signature files and bindings)
70-
- `promise` values and types returned from an `async` function don't auto-collapse into a "flat promise" like in JS (more on this later)
70+
- `promise` values and types returned from an `async` function don't auto-collapse into a flat promise. See the details below.
7171

7272
## Types and `async` functions
7373

markdown-pages/docs/manual/browser-support-polyfills.mdx

Lines changed: 0 additions & 20 deletions
This file was deleted.

markdown-pages/docs/manual/build-configuration.mdx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,13 @@ Here, the file `src/MyMainModule.res` is exposed to outside consumers, while all
8181
}
8282
```
8383

84-
## bs-dependencies, bs-dev-dependencies
84+
## dependencies, dev-dependencies
8585

8686
List of ReScript dependencies. Just like `package.json`'s dependencies, they'll be searched in `node_modules`.
8787

88-
Note that only sources marked with `"type":"dev"` will be able to resolve modules from `bs-dev-dependencies`.
88+
Note that only sources marked with `"type":"dev"` will be able to resolve modules from `dev-dependencies`.
8989

90-
## external-stdlib
91-
92-
**Since 9.0**: This setting allows depending on an externally built stdlib package (instead of a locally built stdlib runtime). Useful for shipping packages that are only consumed in JS or TS without any dependencies to the ReScript development toolchain.
93-
94-
More details can be found on our [external stdlib](./build-external-stdlib.mdx) page.
90+
> The legacy keys `bs-dependencies` and `bs-dev-dependencies` are still accepted but deprecated.
9591
9692
## js-post-build
9793

@@ -155,7 +151,8 @@ This configuration only applies to you, when you develop the project. When the p
155151

156152
## suffix
157153

158-
**Since 11.0**: The suffix can now be freely chosen. However, we still suggest you stick to the convention and use
154+
**Since 11.0**: The suffix can be freely chosen. However, we still suggest you stick to the convention and use
155+
159156
one of the following:
160157

161158
- `".js`
@@ -190,12 +187,14 @@ Turn off warning `44` and `102` (polymorphic comparison). Turn warning `5` (part
190187

191188
The warning numbers are shown in the build output when they're triggered. See [Warning Numbers](./warning-numbers.mdx) for the complete list.
192189

193-
## bsc-flags
190+
## compiler-flags
194191

195192
Extra flags to pass to the compiler. For advanced usages.
196193

197194
- `-open ABC` opens the module `ABC` for each file in the project. `ABC` can either be a dependency, namespaced project or local module of the current project.
198195

196+
> The legacy key `bsc-flags` is still accepted but deprecated.
197+
199198
## gentypeconfig
200199

201200
To enable genType, set `"gentypeconfig"` at top level in the project's `rescript.json`.

markdown-pages/docs/manual/build-external-stdlib.mdx

Lines changed: 0 additions & 62 deletions
This file was deleted.

markdown-pages/docs/manual/build-monorepo-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The root `rescript.json` manages the monorepo by listing its packages.
5858
"in-source": true
5959
},
6060
"suffix": ".res.mjs",
61-
"bsc-flags": []
61+
"compiler-flags": []
6262
}
6363
```
6464

markdown-pages/docs/manual/build-performance.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ The watcher is also just a thin file watcher that calls `rescript.exe`. We don't
6868

6969
ReScript doesn't take whole seconds to run every time. The bulk of the build performance comes from incremental build, aka re-building a previously built project when a few files changed.
7070

71-
In short, thanks to our compiler and the build system's architecture, we're able to **only build what's needed**. E.g. if `MyFile.res` isn't changed, then it's not recompiled. You can roughly emulate such incrementalism in languages like JavaScript, but the degree of correctness is unfortunately low. For example, if you rename or move a JS file, then the watcher might get confused and not pick up the "new" file or fail to clean things up correctly, resulting in you needing to clean your build and restart anew, which defeats the purpose.
72-
73-
Say goodbye to stale build from your JavaScript ecosystem!
71+
In short, thanks to our compiler and the build system's architecture, we're able to **only build what's needed**. If `MyFile.res` isn't changed, it isn't recompiled. Renaming or moving files is handled automatically, with no stale builds.
7472

7573
## Speed Up Incremental Build
7674

markdown-pages/docs/manual/control-flow.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ order: 14
1010

1111
ReScript supports `if`, `else`, ternary expression (`a ? b : c`), `for` and `while`.
1212

13-
The `switch` pattern has a default case too, just like many other functional languages. Read more about [pattern-matching & destructuring](./pattern-matching-destructuring.mdx). there.
13+
The `switch` pattern supports a default case. Read more about [pattern-matching & destructuring](./pattern-matching-destructuring.mdx).
1414

1515
## If-Else & Ternary
1616

17-
Unlike its JavaScript counterpart, ReScript's `if` is an expression; they evaluate to their body's content:
17+
ReScript's `if` is an expression; it evaluates to its body's content:
1818

1919
<CodeTab labels={["ReScript", "JS Output"]}>
2020

@@ -94,7 +94,7 @@ var message = isMorning ? "Good morning!" : "Hello!";
9494

9595
</CodeTab>
9696

97-
**`if-else` and ternary are much less used** in ReScript than in other languages; [Pattern-matching](./pattern-matching-destructuring.mdx) kills a whole category of code that previously required conditionals.
97+
`if-else` and ternary are often replaced by [pattern matching](./pattern-matching-destructuring.mdx), which handles a wide range of conditional logic more expressively.
9898

9999
## For Loops
100100

markdown-pages/docs/manual/converting-from-js.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ReScript offers a unique project conversion methodology which:
1212

1313
- Ensures minimal disruption to your teammates (very important!).
1414
- Remove the typical friction of verifying conversion's correctness and performance guarantees.
15-
- Doesn't force you to search for pre-made binding libraries made by others. **ReScript doesn't need the equivalent of TypeScript's `DefinitelyTyped`**.
15+
- Doesn't require pre-made binding libraries. You can write bindings directly for any JavaScript API.
1616

1717
## Step 1: Install ReScript
1818

0 commit comments

Comments
 (0)