a toolset comprised of a syntax, an interpreter, a bytecode compiler, a debugger, a package manager (OPAM), and a native code compiler What’s so special about OCaml?
replaced Facebook can develop Reason as a syntax for OCaml Bloomberg can develop BuckScript as a compiler for OCaml to JavaScript And if something like WebAssembly gets super popular the compiler could just as easily be replaced with a different one for that What’s so special about OCaml?
replaced Facebook can develop Reason as a syntax for OCaml Bloomberg can develop BuckScript as a compiler for OCaml to JavaScript And if something like WebAssembly gets super popular the compiler could just as easily be replaced with a different one for that What’s so special about OCaml?
replaced Facebook can develop Reason as a syntax for OCaml Bloomberg can develop BuckleScript as a compiler for OCaml to JavaScript And if something like WebAssembly gets super popular the compiler could just as easily be replaced with a different one for that What’s so special about OCaml?
replaced Facebook can develop Reason as a syntax for OCaml Bloomberg can develop BuckleScript as a compiler for OCaml to JavaScript And if something like WebAssembly gets super popular the compiler could just as easily be replaced with a different one for that What’s so special about OCaml?
can develop Reason as a syntax for OCaml Bloomberg can develop BuckScript as a compiler for OCaml to JavaScript And if something like WebAssembly gets super popular the compiler could just as easily be replaced with a different one for that What’s so special about Reason?
code formatting and linting on save with refmt Compiles to human-readable JS with does dead- code elimination Typing built in What’s so special about Reason?
code formatting and linting on save with refmt Compiles to human-readable JS with dead-code elimination Typing built in What’s so special about Reason?
code formatting and linting on save with refmt Compiles to human-readable JS with dead-code elimination Typing built in What’s so special about Reason?
this part of the presentation from a fun talk by Patrick Stapfer (@ryyppy) at the ReasonML London meetup Full code for the provided example can be found at github.com/ryyppy/reason-lnd
..., null], progress: "turn", player: "x", }; Why could this be problematic? No specification of what types can occupy board, progress, or player. Who knows what could go in there ¯\_(ツ)_/¯
..., null], progress: "turn", player: "x", }; Why could this be problematic? No specification of what types can occupy board, progress, or player. Who knows what could go in there ¯\_(ツ)_/¯
..., null], progress: "turn", player: "x", }; Why could this be problematic? No specification of what types can occupy board, progress, or player. Who knows what could go in there ¯\_(ツ)_/¯
"X" | "O" | "Empty"; type Board = Array<Token>; type Player = "X" | "O"; type Progress = "turn" | "win" | "draw"; type State = { board: Board, progress: Progress, player: Player | null, }; This is nicer in that it is self-documenting to an extent and limits some unwanted behaviours
"X" | "O" | "Empty"; type Board = Array<Token>; type Player = "X" | "O"; type Progress = "turn" | "win" | "draw"; type State = { board: Board, progress: Progress, player: Player | null, }; This is nicer in that it is self-documenting to an extent and limits some unwanted behaviours. const state: State = { board: [...], progress: "win", player: null, };
"X" | "O" | "Empty"; type Board = Array<Token>; type Player = "X" | "O"; type Progress = "turn" | "win" | "draw"; type State = { board: Board, progress: Progress, player: Player | null, }; This is nicer in that it is self-documenting to an extent and limits some unwanted behaviours. const state: State = { board: [...], progress: "win", player: null, }; Because progress and player are independent you *could* end up in the confusing state of a game which has been won by nobody
token = | X | O | Empty type board = ... type player = | X | O type progress = | Turn player | Win player | Draw type state = { board: board progress: progress, };
to run into some of the same issues as with JS: type board = list token let ok: board = [Empty, Empty,... , Empty] (9) When compared to JS: type Board = Array<Token>; Both leave the door open to potentially unsafe code, e.g. let derp: board = [Empty] You would probably need to write lots of additional tests to protect against this