by aaron-lebo · 8y ago · 0 comments
JS favors arrays, OCaml lists, so you either write dsls with [| |] (ugly), or you import a module and convert from lists to arrays and your bundle size goes up 80 KB (don't recall if minified or not).
I was surprised to see Reason continue with this syntax. The idiomatic approach for either side is suboptimal unless I'm missing something.
One reason to favor lists over arrays has been that they are immutable. Most of my personal JS array usages have been as dynamically sized arrays, because I’ll use .push all over the place. That usecase is the primary reason to use lists instead: it’s much faster to prepend and destructure on lists.
div [ id "test" ] [ text "stuff" ]
vs div [| id "test" |] [| text "stuff" |]
If the JS library expects an array (not uncommon), that gets ugly quickly.