|
|
|
|
|
by dmix
1457 days ago
|
|
When JavaScript added hash/object deconstruction (both at the argument level and assigning variables) I noticed code has been using Dict-like function arguments everywhere. It makes typing them a bit more of a pain in the ass (especially without default arguments). I haven’t decided if I like it better than just breaking up objects into arguments in a more simple functional style. On one hand it’s more predictable but on the other most complex apps start passing around objects for everything. Typescript of course helps with that, as does nearly modularized code (ie not passing in full typed objects outside of the parent module which owns/generates them unless they uniquely operate on the full object). These are the small rescissions you end up making a hundred times. |
|
Common Lisp: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node252.html
Clojure: http://blog.jayfields.com/2010/07/clojure-destructuring.html
JS: https://simonsmith.io/destructuring-objects-as-function-para...