In the examples below, both external declarations achieve the same functionality with slightly different ReasonML function structures.
Does external declaration style impact anything (e.g. performance) beyond ReasonML function structure? Also, does ReasonML have a "suggested" external declaration "style"?
Type Declarations
type dom;
type element;
External Declaration Style 1
[@bs.val]
external dom: dom = "document";
[@bs.send.pipe : dom]
external get_by_id: string => element = "getElementById";
External Declaration Style 2
[@bs.scope "document"] [@bs.val]
external by_id: string => element = "getElementById";
ReasonML Function Calls
let tag1 = dom |> get_by_id("main");
let tag2 = by_id("main")