Skip to content

Commit 676cbb5

Browse files
committed
Remove [%raw (a, b) => ...] doc
See https://bucklescript.github.io/blog/2020/02/04/release-7-1-0. No longer needed.
1 parent c4a98d0 commit 676cbb5

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

docs/embed-raw-javascript.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ let f = [%raw "function() {return 1}"]
4242
let f = [%raw "function() {return 1}"];
4343
```
4444

45-
You can also pass a function declaration with a string body in `raw`:
46-
47-
```ocaml
48-
let f: (int -> int -> int) = [%raw fun a b -> "{return a + b}"]
49-
```
50-
51-
```reason
52-
let f: (int, int) => int = [%raw (a, b) => "{return a + b}"];
53-
```
54-
55-
Output:
56-
57-
```js
58-
var f = function (a,b){{return a + b}};
59-
```
60-
61-
If you _have_ to use `raw` in the first place, then prefer this format when you're passing a function. This allows the compiler to understand that it's a function, to see the number of arguments it has, to detect some side-effects and to generate better JS code. Also note that while the function's type annotation (`(int -> int -> int)` in the preceding OCaml example) is not strictly required, it gives the compiler a better chance to understand your raw JavaScript, and you may get a compiler warning without it.
62-
6345
<!-- TODO: add explaination about extension syntax -->
6446
<!-- TODO: add reason counter part -->
6547

docs/interop-cheatsheet.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ The next few sections will cover these in detail. Feel free to skip this one if
99
```ocaml
1010
let add = [%raw "a + b"]
1111
[%%raw "var a = 1"]
12-
let myFunction = [%raw fun a b -> "return a + b"]
1312
```
1413

1514
```reason
1615
let add = [%raw "a + b"];
1716
[%%raw "var a = 1"];
18-
let myFunction = [%raw (a, b) => "return a + b"];
1917
```
2018

2119
## String Unicode & Interpolation

0 commit comments

Comments
 (0)