Skip to content

Commit 3f48d05

Browse files
committed
Merged master
2 parents 00c5302 + 919b378 commit 3f48d05

File tree

581 files changed

+139386
-129088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

581 files changed

+139386
-129088
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Issues are for bugs. If you have questions, ask them on a [community forum][comm]. Folks are friendly and happy to help!
1+
Issues are for bugs. If you have questions, ask them on a [community forum][forum] or [chat][chat]. Folks are friendly and happy to help!
22

3-
[comm]: https://discord.gg/reasonml
3+
[forum]: https://reasonml.chat
4+
[chat]: https://discord.gg/reasonml
45

56
For bug reports, in general, it is recommended to report potential bugs in **OCaml syntax**, this will help reduce the possible bug causes from Reason side.
67

CONTRIBUTING.md

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ npm run build
5050
And whenever you modify a file in bucklescript, run this inside `jscomp/`:
5151

5252
```
53-
make ../lib/bsc.exe && ./install-bsc.sh
54-
make ../lib/bsb.exe && ./install-bsb.sh
53+
make ../lib/bsc.exe && ./install-bsc.sh # build the compiler and make it available globally
54+
make ../lib/bsb.exe && ./install-bsb.sh # build the build system and make it available globally
5555
```
5656

5757
This will substitute the global `bsc.exe` & `bsb.exe` you just installed with the newly built one. Then run `npm build again` in the dummy project and see the changes! The iteration cycle for testing these should be around 2 seconds =).
@@ -61,16 +61,15 @@ This will substitute the global `bsc.exe` & `bsb.exe` you just installed with th
6161
Did any of the above step not work?
6262

6363
- If you get compilation errors even from a supposedly clean compilation, you might have skipped the opam reinstall step above: `opam switch reinstall 4.02.3+buckle-master`
64-
6564
- Make sure you did "eval `opam config env`" In your CLI/bashrc/zshrc
66-
6765
- **If the vendored ocaml changed between when you last iterated on the repo and now**, you probably skipped the `opam switch reinstall 4.02.3+buckle-master` part. You'll have to do `git clean -xdf` and then restart with the build instructions. Careful, as `git clean` removes your uncommitted changes.
68-
6966
- **If these fail too**, make sure you do have the correct `ocamlopt` in your environment: `which ocamlopt` should show an `opam` path, not `reason-cli` path. If you see the latter, this means it overrode the global `ocamlopt` BuckleScript needed. In this case, either temporarily uninstall reason-cli or make sure your opam PATH overrides the reason-cli PATH (and not the other way around) in your bashrc/zshrc.
7067

71-
## Special Iteration Workflow
68+
Whenever there are dependencies changes: do `make depend` in the specific directory, when available. This allows the makefile to track new dependencies.
69+
70+
## Change the Vendored OCaml Compiler
7271

73-
This section is reserved for when you're making a change to the vendored ocaml compiler itself, in vendor/ocaml, and then testing on super-errors changes at the same time. If you're doing this for whatever reason, then the previous quick iteration workflow wouldn't work. Here's what you have to do after each change:
72+
This section is reserved for when you're making a change to the vendored ocaml compiler itself, in `vendor/ocaml`, and then testing on super-errors changes at the same time. If you're doing this for whatever reason, then the previous quick iteration workflow wouldn't work. Here's what you have to do after each change:
7473

7574
```
7675
# at project root
@@ -121,27 +120,16 @@ The API reference is generated from doc comments in the source code.
121120
Some tips and guidelines:
122121

123122
- The first sentence or line should be a very short summary. This is used in indexes and by tools like merlin.
124-
125123
- Ideally, every function should have **at least one** `@example`.
126-
127124
- Cross-reference another definition with `{! identifier}`. But use them sparingly, they’re a bit verbose (currently, at least).
128-
129125
- Wrap non-cross-referenced identifiers and other code in `[ ... ]`.
130-
131126
- Escape `{`, `}`, `[`, `]` and `@` using `\`.
132-
133127
- It’s possible to use `{%html ...}` to generate custom html, but use this very, very sparingly.
134-
135128
- A number of "documentation tags" are provided that would be nice to use, but unfortunately they’re often not supported for \`external\`s. Which is of course most of the API.
136-
137129
- `@param` usually doesn’t work. Use `{b <param>} ...` instead
138-
139130
- `@returns` usually doesn’t work. Use `{b returns} ...` instead.
140-
141131
- Always use `@deprecated` when applicable.
142-
143132
- Always use `@raise` when applicable.
144-
145133
- Always provide a `@see` tag pointing to MDN for more information when available.
146134

147135
See [Ocamldoc documentation](http://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#sec333) for more details.
@@ -151,6 +139,59 @@ To generate the html, run `make docs` in `jscomp/`.
151139
Html generation uses a custom generator located in `odoc_gen/` and
152140
custom styles located in `docs/api_static`.
153141

142+
## Make a Release
143+
144+
In release mode, assuming you have NodeJS and OCaml compiler with the right version installed:
145+
146+
```sh
147+
node scripts/install.js
148+
```
149+
150+
The build process will generate configure file with correct `LIBDIR` path,
151+
build all binaries and libraries and
152+
install the binaries into `bin` and lib files into `lib`.
153+
154+
First it will try to generate `bin/config_whole_compiler.ml` based on existing
155+
OCaml installation, if it fails, it will try to invoke `buildocaml.sh` to
156+
install an OCaml compiler from scratch, and retry again.
157+
158+
### Publish Process
159+
160+
- Run `make force-snapshotml`
161+
- Bump the compiler version
162+
163+
## Code structure
164+
165+
The highlevel architecture is illustrated as below:
166+
167+
```
168+
Lambda IR (OCaml compiler libs) ---+
169+
| ^ |
170+
| | Lambda Passes (lam_* files)
171+
| | Optimization/inlining/dead code elimination
172+
| \ |
173+
| \ --------------------------+
174+
|
175+
| Self tail call elimination
176+
| Constant folding + propagation
177+
V
178+
JS IR (J.ml) ---------------------+
179+
| ^ |
180+
| | JS Passes (js_* files)
181+
| | Optimization/inlining/dead code elimination
182+
| \ |
183+
| \ -------------------------+
184+
|
185+
| Smart printer includes scope analysis
186+
|
187+
V
188+
Javascript Code
189+
```
190+
191+
Note that there is one design goal to keep in mind, never introduce
192+
any meaningless symbol unless real necessary, we do optimizations,
193+
however, it should also compile readable output code.
194+
154195
## Contribution Licensing
155196

156197
Since BuckleScript is distributed under the terms of the [LGPL Version 3](LICENSE), contributions that you make

Changes.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# 3.0.0
2+
3+
Features:
4+
5+
- #2740, #2726 Generalized safe/cleaner embedding raw function (https://bucklescript.github.io/docs/en/interop-cheatsheet.html#generaizlied-raw-js-since-300)
6+
7+
- #2687, #2665, #2663 bs.deriving abstract type, a powerful way for idiomatic JS and FFI
8+
(https://bucklescript.github.io/docs/en/generate-converters-accessors.html#abstract-type)
9+
10+
- #2696, #2742, #2706, #2711, compile OCaml boolean as JS boolean
11+
Breaking change to your code path relying on `Obj.magic` and `bs.raw`
12+
13+
14+
15+
- #2741 add Node.Buffer.fromStringWithEncoding
16+
- #2737 add Js.Json.stringifyWithSpace
17+
- #2728 add console.error and console.trace
18+
- #2666 add List.sort to belt
19+
- #2664 pipe syntax support tuple
20+
`obj |. method a b ` and `obj |. (m1 , m2)`
21+
22+
23+
Perf:
24+
- #2676 beter optimizations for tuple allocation
25+
26+
Docs:
27+
- #2730, #2729, #2733, #2722, #2701, #2699 More docs to Belt
28+
29+
Fixes:
30+
- #2657 more intuitive polymorphic comparison with objects
31+
- #2686 playground unicode
32+
- #2720, #2719, #2718, error message enhancment
33+
- #2731 not inlining function contains `raw`
34+
- #2672 Fix ci
35+
- #2652 fix Buffer name mangling on Node
36+
- #2642 weird indentation in generated code
137

238
# 2.2.3
339

0 commit comments

Comments
 (0)