实际开发中，一个常规的代码库，很难在短短几天之内，从一种技术转换成另一种技术的实现，这个过程可能会花费几个月甚至几年。 对于一个互操作性没有充分仔细的被设计的语言， 如果还在犹豫是否应该引入到代码库中的时候，转换代价在初期将成为这个语言的价值的短板，并最终放弃这个语言。
The above section might sound a bit buzzword-y; here is how we've designed BuckleScript's interop, from the lowest part of the stack to the highest.
__$INTERNAL$hello$1， 干净的名称（没有被混淆过的）能够更好的调试。 我们见过一个团队中，有对BuckleScript和Reason不是那么熟悉的成员需要紧急修复bug的场景，直接在BuckScript文件中写一段原始的js代码。 邻人欣慰的是BuckleScript设计了这样的"最后逃生窗口"，实在没招的情况下这种方式也是支持的。
BuckleScript（简称BS）的主要数据结构完全映射到了JS的数据结构，例如，BS 中的string 就是js中的string，BS 中的 array 就是 js中的 array，下面就是BS的代码：
let messages = [| "hello"; "world"; "how"; "are"; "you" |]
let messages = [|"hello", "world", "how", "are", "you"|];
Roughly compiles to the JS code:
var messages = ["hello", "world", "how", "are", "you"]
There is zero mental and performance overhead while using such value. Naturally, the value on the BuckleScript side is automatically typed to be an array of strings.
This behavior doesn't hold for complex data structures; the dedicated sections for each offer more info.
In most cases, you can directly call a JS function from BS, and vice-versa! These calls are free of performance overhead in most cases.
let declarations in a BS file is exported by default and usable from JS. For the other way around, you can declare in a BS file what JS module you want to use inside BS. We can both output and consume CommonJS, ES6 and AMD modules.
BS comes with a lightning-fast (fastest?) build system. It starts up in a few milliseconds and shuts down as fast. Incremental compilation is two digits of milliseconds. This allows the build system to be inserted invisibly into your whole JS build pipeline without embarrassing it. Unless your JS build pipeline is already embarrassingly slow. That's ok.
1 BS file compiles to 1 JS file. The build can be configured to generate JS files alongside or outside your
re source files. This means you don't have to ask the infra team's help in trying out BuckleScript at your company; simply generate the JS files and check them in. From the perspective of the rest of the compilation pipeline, it's as if you've written these JS files by hand. This is how Messenger successfully introduced Reason into the codebase.
We use NPM and Yarn. Since the generated output is clean enough, you can publish them at NPM
prepublishOnly time and remove all trace of BuckleScript beforehand. The consumer wouldn't even know you wrote in BS, not JS! Check your
node_modules right now; you might have been using some transitive BS code without knowing!
Hopefully you can see from the previous overview that we've poured lots of thoughts into simplicity, familiarity and performance in the interop architecture. The next few sections describe each of these points in detail.