3 ms·
> it gives you the simplest no-BS object/array literals you can get I really don't think that: { "foo": "bar", "baz": ["quux", 1, true] }
by zeveb 10y ago
> it gives you the simplest no-BS object/array literals you can get
I really don't think that:
{
"foo": "bar",
"baz": ["quux", 1, true]
}
is simpler than:
((foo bar)
(baz (quux 1 true)))
Quite the opposite, really.
- dccoolgai 10y agoThat does look nice. Is that, LISP? To my eye, they look roughly equivalent, though - and a lot of what I consider the "No-BS object system" occurs after the literal is declared - adding and manipulating properties, etc.
- zeveb 10y ago> Is that, LISP? Well, S-expressions, which can be used for Lisp code, but can also just be used for plain data. > a lot of what I consider the "No-BS object system" occurs after the literal is declared - adding and manipulating properties, etc. Yeah, it's definitely convenient to use, even more so than Python's objects. I prefer a stronger type system for my own software though.
- akubera 10y agoQuestion: Can s-expression list-of-lists really be used to represent an unordered map when it comes to operations like equality? Or rather, does one simply use expectations/context to compare this object to, say [["foo", "bar"], ["baz", ["quuz", 1, true]]] making it a non-issue?
- zeveb 10y ago> Question: Can s-expression list-of-lists really be used to represent an unordered map when it comes to operations like equality? With the right predicates, anything is possible grin I think that context unavoidable: one can't just read a JSON value into a generic data structure, or even into a typed structure: one has to apply the types of one's business logic (e.g. 'user-id' must not only be a string, but a string beginning with either 'E' or 'C'). In that context (pun intended), then it makes sense for equality comparisons to be at the business-object layer, not at the freshly-deserialised JSON object layer.
- Anasufovic 10y agoThe bottom is definitely ambiguous.
- zeveb 10y agoWhat's ambiguous? If you don't like that it's using a list to represent a map, you could always use: (map (foo bar) (baz (quux 1 true))) But you might reflect on the fact that JSON uses an ordered sequence of bytes to represent an unordered collection of properties and values.