BuckleScript

BuckleScript

  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub

›Intro

Intro

  • What & Why
  • Installation
  • New Project
  • Try
  • Concepts Overview
  • Upgrade Guide to v7

Interop

  • Overview
  • Cheatsheet
  • Embed Raw JavaScript
  • Common Data Types
  • Intro to External
  • Bind to Global Values
  • Null, Undefined & Option
  • Object
  • Object 2
  • Class
  • Function
  • Property access
  • Return value wrapping
  • Import & Export
  • Regular Expression
  • Exceptions
  • JSON
  • Pipe First
  • Generate Converters & Helpers
  • Better Data Structures Printing (Debug Mode)
  • NodeJS Special Variables
  • Miscellaneous
  • Browser Support & Polyfills

Build System

  • Overview
  • Configuration
  • Automatic Interface Generation
  • Interop with Other Build System
  • Performance
  • Advanced

Standard Library

  • Overview

Advanced

  • Conditional Compilation
  • Extended Compiler Options
  • Use Existing OCaml Libraries
  • Difference from Native OCaml
  • Compiler Architecture & Principles
  • Comparison to Js_of_ocaml
Edit

Concepts Overview

Before starting the next few sections, here are a helpful things to know:

OCaml

This is the backing of BuckleScript. BuckleScript is a fork of OCaml, specifically v4.02.3 (upgrade impending!). This doc site assumes basic knowledge of OCaml; you can learn OCaml through Real World OCaml or, if you're learning Reason anyway, start with the Reason site.

This documentation site will mostly cover just the extra bits we've added to OCaml to enable good JS interoperability.

Reason

An alternative syntax for OCaml that's more familiar to JS programmers and reduces the learning overhead a bit. Reason works with OCaml, since apart from the syntax they share most other things. This also means Reason works with BuckleScript. The latter has some first-class support for some other utilities of Reason.

OPAM

This is OCaml's official package manager. Since BuckleScript uses NPM and Yarn, you won't need OPAM as a beginner. We will mention it for advanced workflows.

External/Interop/FFI

These are all jargon for working with BuckleScript <-> JavaScript.

External: in the context of BuckleScript, one of the primary ways to use a JS value.

Interop: short for "interoperability".

FFI: Foreign Function Interface. The general term for things like "external", "wrapper" and "interop". Basically means calling a value from the other language. Prefer the first two terms.

Last updated on 4/13/2020
← TryUpgrade Guide to v7 →
  • OCaml
  • Reason
  • OPAM
  • External/Interop/FFI