diff --git a/_blogposts/2020-12-07-release-8-4.mdx b/_blogposts/2020-12-07-release-8-4.mdx new file mode 100644 index 000000000..2c8980c4f --- /dev/null +++ b/_blogposts/2020-12-07-release-8-4.mdx @@ -0,0 +1,94 @@ +--- +author: hongbo +date: "2020-12-07" +previewImg: +category: compiler +title: ReScript 8.4 +description: | +--- + +## Introduction + +ReScript is a soundly typed language with an optimizing compiler focused on the JS platform. +It's focused on type safety, performance and JS interop. It used to be called BuckleScript. + +[ReScript@8.4](https://www.npmjs.com/package/bs-platform/v/8.4.2) is now available for testing, you can try it via + +``` +npm i bs-platform@8.4.2 +``` + +The changes are listed [here](https://github.com/rescript-lang/rescript-compiler/blob/master/Changes.md#841). + +We will go through some highlighted changes. + +### The integrity of `bsb -make-world` + +When we introduced `bsb` as a build system around four years ago, we made the assumption that dependencies are immutable, +so that once it's built for the first time, we don't need to rebuild it any more. The integrity of `bsb -make-world` will be broken +when the assumption does not hold. + +In this release, we fix the integrity of `bsb -make-world` which allows user to changes the dependencies. +The fix is well implementend that people who don't do such modifications will not pay for it. + +This is one of the highest desired feature request based on the +[user feedback](https://github.com/rescript-lang/rescript-compiler/issues/4361#issuecomment-739538789), so we will expand a bit here why it is tricky +to implement it without compromising performance. + +In ReScript compilation scheme, dependencies as packages are treated as a blackbox, +changes of dependencies should be *transitive*. The is due to that we have cross module +optimizations and the binary interface itself is a hash of its dependencies. +So for a package dependency chain: A -> B -> C, if A changes and B does not change, C still needs get rebuilt. +Because the intermediate output of B may still change due to the change of A. +To make things worse, each package comes with an installation process which is a shell script, so re-installation will make the +package look like freshly built. + +In this release, we track the installation in the build graph as well, and we calculate the hash of the installation of dependencies and put it in the +dependent's command line flags for building binary artifacts. Such strategy benefits in such aspects: + +- The calculation of the hash of installation is almost free since it is just one stat, we don't need track all dependencies' artifacts. +- The introducion of such hashing does not appear in parsing, so that the changes of dependencies will never trigger re-parsing. +- Once the package installation is a nop, the transitive rebuild graph will be cut off so that we can save some unneeded rebuild. +- When people make changes to the depdendencies, if such changes don't change the package interface, it will not trigger the build of its dependents. + +### Introducing `pinned-dependencies` + +To make `bsb -make-world` more pratical, we also introduce a new concept called: `pinned-dependencies`. +In general, packages are classified as three categories: + +- toplevel + - warnings reported + - warn-error respected + - build dev dependency + - run custom rules + - package-specs like es6/commonjs overrides all its dependencies +- pinned dependencies + - warnings reported + - warn-error respected + - build dev dependency + - run custom rules +- normal dependencies + - warnings, warn-error ignored + - ignore dev directories + - ignore custom generator rules + +Previously, we only had `toplevel` and `normal dependencies`, by introducing `pinned-dependencies`, +such package will be built mostly like `toplevel` packages. + +The usage is quite simple, add `pinned-dependencies` in the toplevel package's `bsconfig.json`. +Note such field only make sense in toplevel's configuration. + + +### More robust hanlding of removal of staled output + +When people delete or rename rescript files, it will introduce dangling staled output, for example, renaming `src/A.res` +into `src/B.res` will bring `src/A.cmi` (and more intemediate outputs) stale. This is worse than it sounds like, suppose you have a +local `src/List.res` which shadows the stdlib's List. Now we remove it, it will introduce stale `List.cmi` file, without the proper removal +of such stale outptu, such stale `List.cmi` file will break the integrity of the build. + +In this release, we introduced a more robust algorithm that will always remove stale output before the build so +that such integrity is not broken. + +Last but not the least, we continue improving the readability, debuggability of the [generated output](https://github.com/rescript-lang/rescript-compiler/pull/4858) : ) + +Happy Hacking! -- Hongbo Zhang \ No newline at end of file diff --git a/_blogposts/archive/bucklescript-is-rebranding.mdx b/_blogposts/archive/bucklescript-is-rebranding.mdx index d37d17969..a7d8b32f8 100644 --- a/_blogposts/archive/bucklescript-is-rebranding.mdx +++ b/_blogposts/archive/bucklescript-is-rebranding.mdx @@ -47,4 +47,4 @@ Thank you for your support and keep shipping. A brighter future awaits us! Stay safe, -The ReScript team (Bob, Cheng, Cristiano, Maxim, Patrick, Ricky). +The ReScript team (Hongbo, Cheng, Cristiano, Maxim, Patrick, Ricky). diff --git a/index_data/blog_posts.json b/index_data/blog_posts.json index 066312557..304f26270 100644 --- a/index_data/blog_posts.json +++ b/index_data/blog_posts.json @@ -55,5 +55,6 @@ "whats-new-in-7-pt1": "archive/whats-new-in-7-pt1.mdx", "whats-new-in-7-pt2": "archive/whats-new-in-7-pt2.mdx", "editor-support-custom-operators-and-more": "2020-11-17-editor-support-custom-operators-and-more", - "editor-support-release-1-0": "2020-11-26-editor-support-release-1-0" + "editor-support-release-1-0": "2020-11-26-editor-support-release-1-0", + "bucklescript-release-8-4" : "2020-12-07-release-8-4" } diff --git a/pages/docs/manual/latest/faq.mdx b/pages/docs/manual/latest/faq.mdx index 58107f994..534c343c7 100644 --- a/pages/docs/manual/latest/faq.mdx +++ b/pages/docs/manual/latest/faq.mdx @@ -48,7 +48,7 @@ The existing Reason syntax is owned by a different team with a different vision. **Who is behind the project?** -The ReScript team (Bob, Cheng, Cristiano, Maxim, Patrick, Ricky). +The ReScript team (Hongbo, Cheng, Cristiano, Maxim, Patrick, Ricky). **We have a new forum; will we also have our own Discord?** diff --git a/pages/docs/manual/v8.0.0/faq.mdx b/pages/docs/manual/v8.0.0/faq.mdx index 5d8c1bffa..f7fd33c15 100644 --- a/pages/docs/manual/v8.0.0/faq.mdx +++ b/pages/docs/manual/v8.0.0/faq.mdx @@ -44,7 +44,7 @@ The existing Reason syntax is owned by a different team with a different vision. **Who is behind the project?** -The ReScript team (Bob, Cheng, Cristiano, Maxim, Patrick, Ricky). +The ReScript team (Hongbo, Cheng, Cristiano, Maxim, Patrick, Ricky). **We have a new forum; will we also have our own Discord?**