News for hackers. Stuff that matters.
Re:Reason ML toolchain by aaron-lebo on Tuesday February 06, 2018 @02:49PM (#16318960)
One place you can see this in action is that [ ] are lists and [| |] are arrays.

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.

Re:Reason ML toolchain by bsansouci on Tuesday February 06, 2018 @02:58PM (#16319034)
What DSLs are you referring to here?

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.

Re:Reason ML toolchain by aaron-lebo on Tuesday February 06, 2018 @03:03PM (#16319076)
Something like Elm's Html module:

    div [ id "test" ] [ text "stuff" ]
vs

    div [| id "test" |] [| text "stuff" |]
If the JS library expects an array (not uncommon), that gets ugly quickly.
Re:Reason ML toolchain by yawaramin on Tuesday February 06, 2018 @06:15PM (#16320873)
Hi, I'm pretty sure a tree-shaking bundler like Rollup can wipe out most of that bundle size by using only the list functions you need. Then again, if you need to use arrays, use arrays, [|1, 2, 3|] is not actually that bad–you get used to it pretty quickly.