Show newer

@wallhackio i don't think your sister is coping well you should share some techniques

@wallhackio how does it feel to root for the losing team

who would win ?

protestants who are like “we have chosen a branch of catholic thought which is simply too progressive for the roman catholic church to tolerate” are good. protestants who are like “i would like to discard the entire history of catholic thought in favour of this novel interpretation i made up by ignoring all but the literal words of the biblical text” are bad. these are my takes on christian religion

@aescling the whole monarchist lions are innately king thing was always too much for me

@aescling not the part where the birdie gets lost in her tits but the part where maid marian is all princess daisy mario tennis

@aescling this does not help me evaluate whether it holds up

@aescling @wallhackio “shake it out” is a florence + the machine song which is better

@wallhackio @aescling well javascript doesn’t have any native concept of object type so in order to transform JS you have to first identify the type of every object and then call the methods associated with that type

“identify the type of object” can be trivial in the case where every object has a `type` property, but that’s still boilerplate you have to write and most real-world JSON is not this verbose

the end result of all this is that most code for processing JSON is incredibly bespoke

in XML on the other hand, the type of things is obvious (it's the node name), so you can just use a generic recursive descent mechanism with type-specific transforms, and you don’t have to write the first part because that’s XSLT

example JSON:

{ "type": "example"
, "items":
[ { "type": "item"
, "value": 1 }
, { "type": "item"
, "value": 2 } ] }

example XML:

<example>
<items>
<item value="1"/>
<item value="2"/>
</items>
</example>

desired result:

<p>Here are my items: {1}, {2}.</p>

XSLT conversion:

<x:template match="example">
<p>
<x:text>Here are my items: </x:text>
<x:for-each select="items/*"/>
<x:if test="position()!=1">
<x:text>, </x:text>
</x:if>
<x:apply-templates select="."/>
</x:for-each>
<x:text>.</x:text>
</p>
</x:template>
<x:template match="item">
<x:text>{</x:text>
<x:value-of select="@value"/>
<x:text>}</x:text>
</x:template>

conversion from JSON left as an exercise

suppose a new item type is added. with XML/XSLT, this just necessitates adding a single new template to handle it. how much does the code need to change to accommodate this with JSON?

@wallhackio @aescling there are thing which are very easy to do on s-expressions or in XML which are a pain in the ass to do with JSON and those things are basically all of the nature “convert this structure into that structure”

strong argument for just deserializing into a lisp, transforming, and serializing back, and that makes one wonder why you aren’t just using a lisp as your structure to begin with

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.