4 ms·
However, there appears to be a set of common denominators that can be used to represent all possible data-structures: Maps or dictionaries, lists, stri
by stevelosh 15y ago
However, there appears to be a set of common denominators
that can be used to represent all possible
data-structures: Maps or dictionaries, lists, strings,
numbers, boolean and null.
I'd add sets to this list. You can kind of simulate them using a map where the keys are the members and the values are anything, but they just work more smoothly when you have real support for them (like in Python and Clojure, but not Javascript/JSON).
- chrisvest 15y agoI was wondering whether to add sets to the list or not. In the end I decided not to because they look just like lists for the purpose of destructuring and I liked how this list of things matched what JSON provides, plus as you say, they can be simulated. It also left me with one less thing to explain, except now that it didn't.