The ReScript compiler license vs licensing of the generated code from the compiler

The ReScript compiler is covered under a custom LGPL version 3 license with an exception to section 4 of the LGPL license. What are the consequences of this exception?

The reason for my asking is, the following ReScript code for my application:

open RescriptCore

let isEqualTo = (a, boolean) =>
  Option.eq(a, Some(boolean), (x, y) => x == y)

generates the following JS code:

import * as Caml_obj from "./../../node_modules/rescript/lib/es6/caml_obj.js";
import * as Caml_option from "./../../node_modules/rescript/lib/es6/caml_option.js";
import * as Core__Option from "./../../node_modules/@rescript/core/src/Core__Option.mjs";

function isEqualTo(a, $$boolean) {
  return Core__Option.eq(a, Caml_option.some($$boolean), Caml_obj.equal);
}

Caml_option.some is basically the Some variant (language construct) of the Option type.
Caml_obj.equal performs the equality check for two Option values.
Core__Option provides the eq function.

Core__Option is MIT licensed whereas Caml_option and Caml_obj are (as I presume) covered under the compiler’s custom LGPL license with exceptions mentioned earlier.

Does this mean I can safely bundle (using esbuild/Vite) my application code and ReScript standard library code (Belt/Js/RescriptCore) without having to worry about sharing the application code with the users of the application? Note that, I am not modifying any ReScript compiler code or any of the generated code.

I would like a clarification on the obligations I have (imposed by the compiler’s license) while building my application with ReScript language/compiler. Can someone shed some more light on this and about any tricky situation that might arise, if any?

2 Likes

Thank you for asking.
The linking exception is primarily designed this way that you are free to LICENSE your own code.

1 Like

Thank you for your response; it tells us about how this compiler/library can be used.

For the sake of explicitness, let me ask one more question wrt combined work that is generated when we use the compiler, to validate my understanding:

I re-read the compiler’s license and I believe the linking/combined work exception lets me do two things:

  1. I can “combine or link” for instance, Caml_option and Caml_obj with my application’s generated code. (which is what happens when we run rescript build)
  2. Then I can decide the terms of the combined work - the generated code (for example: keep it closed) and thus not comply with section 4 of the LGPL v3 license.

The steps 1 and 2 are allowed under this exception, correct?

[Edit: I renamed the topic]
[Edit 2: Notes below]

Now that I think about it, this is how rescript packages provided by the community are choosing their own terms/license. It should have been obvious to me, but I guess I was panicking when I was being asked to review licenses at my ${day_job}.

Can we add a section about this on the documentation page under Language Manual -> JavaScript Interop -> Libraries and Publishing section or maybe its own section? It would make it easier for corporate organizations to think about adopting ReScript.

3 Likes